From patchwork Tue May 21 07:43:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dev Jain X-Patchwork-Id: 13668973 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7706AC25B74 for ; Tue, 21 May 2024 07:44:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E06656B0088; Tue, 21 May 2024 03:44:22 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DB6786B008A; Tue, 21 May 2024 03:44:22 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CA44E6B008C; Tue, 21 May 2024 03:44:22 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id AE7396B0088 for ; Tue, 21 May 2024 03:44:22 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 39487141144 for ; Tue, 21 May 2024 07:44:22 +0000 (UTC) X-FDA: 82141615164.22.9791DDF Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf28.hostedemail.com (Postfix) with ESMTP id 42027C0016 for ; Tue, 21 May 2024 07:44:20 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf28.hostedemail.com: domain of dev.jain@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=dev.jain@arm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1716277460; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:references; bh=mLgSgHzVr4FEX8NRqmMx3Jb63We5tR0xQDdY3E6OuuA=; b=7METqOaugMQrLWxpU7yos9umUT3HkP0zODdqFpMjGPxDQWNQTE7SkM5smbuzBaK/bFvxh2 LSAeFd97k/leKqhFs+bUCfNf160VvwOBFppeRdw9sPChF92BuLYWtC/+Ea6tz0YG/vR4ug 7bbGqXFj1jqOOeQAXbFByMHgc4Iz0vo= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf28.hostedemail.com: domain of dev.jain@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=dev.jain@arm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1716277460; a=rsa-sha256; cv=none; b=aX323XOP8f/BBvTzvEtf68kUvpwFWjYKxyMACIzdZveeOHWt4uMksM/nJTro6h79UyP6O0 /8bJf1wG5Js9qbi1i715Z8O4zqte26w1HfWvbobgEiwLA/R6mq06kOgDtLvZfOpfSF+M9Z QqwCi+tLiPkitvzrCBFCAHapO7BHl3s= Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 4B37CDA7; Tue, 21 May 2024 00:44:43 -0700 (PDT) Received: from e116581.blr.arm.com (e116581.arm.com [10.162.42.16]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 73AD63F641; Tue, 21 May 2024 00:44:16 -0700 (PDT) From: Dev Jain To: akpm@linux-foundation.org, shuah@kernel.org Cc: linux-mm@kvack.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Anshuman.Khandual@arm.com, sjayaram@akamai.com, Dev Jain Subject: [PATCH v2 0/3] Fixes for compaction_test Date: Tue, 21 May 2024 13:13:55 +0530 Message-Id: <20240521074358.675031-1-dev.jain@arm.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 42027C0016 X-Stat-Signature: pm87crcws4i4rz4y6jynhuo7hoyxzgde X-HE-Tag: 1716277460-27672 X-HE-Meta: U2FsdGVkX1+Cjx6xoSvpd2NR5+5tmIMZUm4OV1YslGAEFxOj/C+BnuzjmgLHLsRmYdY1YCyn3JngaEnd49+f+/FNH81X0JGKbfd7kRzwdgQ9jQ8nsQYzuhTzp/xpr9XuTpiM1R/+eoP0uanuZ5i0iUDkqjMQVf7VET+gM8Db0/hUc9m5/zR9nyG/jWramGpQN6dzLo0g2qGCf3d10OZnZY2efOFM6ljRi8GtBYX8NWXUu3/wROc+vXsrGJpYUrmyHBk5ybIcH82vgDRUpHjv9Bl8cRi0nYCP1D0r39p03X6faFxyq7I/ODCX2vthEW+u6WpxP+nmQ3H85wAymxhukXGWDbdlXaweXc45DQilvu673rcmJ6z+IF7TU9YL4U//742lN/MdtqPTeZpwhrX0gIIdcZjPgiAvEBPTcxW7L2wSFH1vuplyU1O3yaB/rvyAxEiGKxXOsBJpZn2OYL95WAeQkPdPCmR86aRPLksVNTjJyrEN5BkdIgQcWDBdHmgrVpI7iYAQiuRXsh/bMpRjNVNmYAS+eyAkOY3Qw9ZqAU+Bagye6/VauqHV5O4eLC7BuavMyv+uayp96hFtYa/vULUsu/apDtt8BvvVr1WBYrj2F/kU1za/X79Ah/+1lZfxNKwdgGB19LiKwVjpPH/t5mPoyVuqU49fucTEsVqa1Z3ZwBtpG2qEiAPj0HBtVjOfeyYuPRPA7bNEEyQ0aFD88DcYgw0Bv6guQVVnIzv1cqPFP57oxeTlX4o3lpGDKSIg3u5iGkysH3WobUw+hPfoJJqgH9+syp9w89q00LsMCyktjiLq9/d7T0IikkZvrphA6ehyDmA74LGvLV+th+PFscesdU9jusZIP3MS5/du2uUUqr72PVU8ztjSOKeCnv4A3o35tz0siGUHR/JREnk7ATFwh+T7kCP6U5mmwM4vxIxAEb0g75fBdbb7T/ORfaXUeTpFzRVuS0lLlu4YO8h HIQWuIFX NzIIyjbFFmL6ZAw7Wcu1gKZBa8qT5LDEUM7KqYSH6l4UBSy/PVSz7R8zRXqwtW4TrxC/uOO5innTnKCXE124Vol1rs1zPXMgQnNmvXiAp45w039D7fdWKA+2zevwUNV3wOfEUJiiJNthlTJj8layRkWSHsU1U9X9xUn8W5kAbHE5DH4Z8lABuGsTj2drjnfeTrRUXgpjz7VjTwIoijbuiS3MvjhDE1ZphNBBkcGmil/Jp4a7/9LUroiI+6dsHS/d1lvyqdSXXupa2cII= X-Bogosity: Ham, tests=bogofilter, spamicity=0.001321, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: The compaction_test memory selftest introduces fragmentation in memory and then tries to allocate as many hugepages as possible. This series addresses some problems. On Aarch64, if nr_hugepages == 0, then the test trivially succeeds since compaction_index becomes 0, which is less than 3, due to no division by zero exception being raised. We fix that by checking for division by zero. Secondly, correctly set the number of hugepages to zero before trying to set a large number of them. Now, consider a situation in which, at the start of the test, a non-zero number of hugepages have been already set (while running the entire selftests/mm suite, or manually by the admin). The test operates on 80% of memory to avoid OOM-killer invocation, and because some memory is already blocked by hugepages, it would increase the chance of OOM-killing. Also, since mem_free used in check_compaction() is the value before we set nr_hugepages to zero, the chance that the compaction_index will be small is very high if the preset nr_hugepages was high, leading to a bogus test success. This series applies on top of the stable 6.9 kernel. Changes in v2: - Handle an unsigned long number of hugepages - Combine the first patch (previously standalone) with this series Link to v1: https://lore.kernel.org/all/20240513082842.4117782-1-dev.jain@arm.com/ https://lore.kernel.org/all/20240515093633.54814-1-dev.jain@arm.com/ Dev Jain (3): selftests/mm: compaction_test: Fix bogus test success on Aarch64 selftests/mm: compaction_test: Fix incorrect write of zero to nr_hugepages selftests/mm: compaction_test: Fix bogus test success and reduce probability of OOM-killer invocation tools/testing/selftests/mm/compaction_test.c | 85 ++++++++++++++------ 1 file changed, 60 insertions(+), 25 deletions(-)