From patchwork Wed May 15 09:36:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dev Jain X-Patchwork-Id: 13664939 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 A3FA8C25B75 for ; Wed, 15 May 2024 09:36:58 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 13C996B03A1; Wed, 15 May 2024 05:36:58 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0C6D06B03E1; Wed, 15 May 2024 05:36:58 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EAA496B03E2; Wed, 15 May 2024 05:36:57 -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 CAFFD6B03A1 for ; Wed, 15 May 2024 05:36:57 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 3CB93C0C4A for ; Wed, 15 May 2024 09:36:57 +0000 (UTC) X-FDA: 82120126074.02.5E7758F Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf12.hostedemail.com (Postfix) with ESMTP id 617E74001D for ; Wed, 15 May 2024 09:36:55 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf12.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=1715765815; 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=AMnzWc8aPGeKTH+oGeb5ZdjQdZvZwN88Ten4/FKn/QA=; b=FkbJk8/v0LIF64AH53hwRxDTpztD+dHxK1QfTNN9Kfx0qc/nTNm6cKhX1IZTQJSHjAH0UU hdyDx0GrgYTqTEyBU4NvGT717b/ztZ4T/QPd9FnDj9ttxwEpCzc0DDqpcAyB+w6HyOZH8r N5yoEtzg6VL4bjpisma6sxjzB2wG5zE= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf12.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=1715765815; a=rsa-sha256; cv=none; b=P/73U9Ixtm8MNORrjayHfRyzmSOuZMCf5dd5M/u6TVJtYOU3lLb5YDdcjUhxve/d3fCDxR W1UVu9vMArTzGKDnuOSjntj6yX4rHnpW99+RT1PaXAYbQsziutlEMMLS8MkSE7OV3VYKAB XyM8BmTnzVWtZxbfhA/9HGaq2ylPgEI= 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 168861007; Wed, 15 May 2024 02:37:19 -0700 (PDT) Received: from e116581.blr.arm.com (e116581.arm.com [10.162.42.15]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 70ADD3F7A6; Wed, 15 May 2024 02:36:51 -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 0/2] Fixes for compaction_test Date: Wed, 15 May 2024 15:06:31 +0530 Message-Id: <20240515093633.54814-1-dev.jain@arm.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Stat-Signature: cd8enxd47hfypnmpttf6s9dboco9hsrw X-Rspamd-Queue-Id: 617E74001D X-Rspam-User: X-Rspamd-Server: rspam10 X-HE-Tag: 1715765815-492946 X-HE-Meta: U2FsdGVkX1/eJwbuB72/Upz7ebE4gJsv+koPmF4Jwl5KiITb7StYHrygCMdVMVqQlsQyll/cJ5vD4cfz513rXah2Z9ikAA1hid0+oGOLyOBwLnr92tbQp7744F0GGyJxs3GJVHcgl3R64D6+q/AE/+OzjjdDP3+uYApqIzD9DYUULh6FvmJ/XHYRnludWfWIbn/5TRXDAdzPMMegGXyrkGpfombrLhJNP1FUcD9y04XKbJXiqoZYmNH3bBcAfKVB8eUro1ANfCQmCXCJu+vew/kImKCBCO4fPdcBnnVCYz7PWzTfwOlsg7jXQh6GuJj2sf73jHcGzb7bFuucgYUWGkZaQ9sQDWGSBc7f0MM50AkL1+osKPRJQuU4i2nVH7PID1mdKs8JQt2M4eS9qv0zYjzzboL3G7H5C78jd6XqeYGQQafQXdGIVIbUvw3NnR8Id2X3PnpiBXZ0gwfHbMt/dpJ0ppPsgtF3PdVxTvJ/ylKLmswF5PISITlbDsgInVp/Fy7YHOtTst599Pf4jcuhip+N5NdVblvfudGa34+MGU+x096AXxcAcjnhGzYDg0PHmbhNICtdewFocA6bbMeAj5GkbIGWwTk5+lmDQAjV+IrkmG075TPv4HSrQFZUeVYt4948L40YJZiE9NjhFVGTUK2JNWVeKVMr2t3S6Mxce1KG67dPHBNs87dinuxpm6AYf1ApgbNv9X6hBxRaToNX51nljoA6XhfZR0B+IJmYkUSOMu60UmgxTNtsIPTY5COrXM0XAFep5FVc8MDE06dJDxr5tk6co4sRN6ZJhg30RfOUmWitI4vM08HkuneKIkz09UfaG9cJU33IT/ju/ncej9lmz7rbNfIf6nb/VaFc3NKVtJm3WOTw4x1ce9f9gW6dn8mtWLT2h+xV7c6tgBukIyjqHe4Z8fF5lw+hr/AXTfjSpCXUkBK89h3DHwVuzkIQ0saUT+/0+DuPowZ7aMj LI8ZUx0e dhPcADaOHIzin2BQhVhZqoD5wc7yvUR9lOnu5E4lTUJxvakWnRpoK8XeRcDm3V+CbEMnBePk1psbz7JJTa+huScldG7iJKaOQw/XD7PJ7maYHAE48Womj9xb4OOl4t7XUcPHSA+sESLm7Xdc= X-Bogosity: Ham, tests=bogofilter, spamicity=0.009999, 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. First off, 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. Dev Jain (2): selftests/mm: compaction_test: Fix incorrect write of zero to nr_hugepages selftests/mm: compaction_test: Fix trivial test success and reduce probability of OOM-killer invocation tools/testing/selftests/mm/compaction_test.c | 70 ++++++++++++++------ 1 file changed, 50 insertions(+), 20 deletions(-)