Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp2917905lqo; Tue, 21 May 2024 00:44:29 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWPQNT09nPF1p3k6EzDxNtzIPF/zLYrK9hkLb/wZCdD1HheVg0IvJ2KChqSQCqdrNVK/vhe0TXmrCN/4aCL+cAdBt6B9BVat2S/1sCxPA== X-Google-Smtp-Source: AGHT+IHtB44U4OkJHxmVS23qej1hVmEWADWtj4SiPwwXczGOQJJPTjHq5DEYnHPiquWCRs2wM9bV X-Received: by 2002:a17:906:b79a:b0:a59:aa69:9790 with SMTP id a640c23a62f3a-a5a2d54c87fmr1956596066b.8.1716277469116; Tue, 21 May 2024 00:44:29 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716277469; cv=pass; d=google.com; s=arc-20160816; b=y60ILX/K6E2qaHQtn/Ov4116CS9qSt9VP3sCiPpfXmWhkHgVCtUhZRHpvVlvNqSoW/ v10CklYwJ605h/9WyKWQ3Bjii+AF6gT4aXlec90oihd6h7xdjnFrZs6dCdDd/sxhNcRD 8MVa1PwdeXxOSW1XBfU0tVK/CPRCj57er9+LZu6A2R/BgtcaeHjAjipzu1hMiWumBIsz vZ02lmPoyUH/SCa0tuO9EPfM34mYk7yUyNOh2syi8DUQdgV1yEo+jSXiZFC/7/xNQFSF Ei1fHLSiJl/pf4uJvWm/PQGld4dJitjHa5fYajbb7xUUAIge4XjSA+QBAp6aVJNnpBIv zX1w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from; bh=mLgSgHzVr4FEX8NRqmMx3Jb63We5tR0xQDdY3E6OuuA=; fh=sar7720kn2Lr+6kVe4804d7lhk4DvrTmM9Xuy8xoz4E=; b=utwgqV8D6J7OARIVr2mFG1VR9dEWa66N5+10+CJ89Rjm1whfTPthr3/pZtkJ49/LXD owTPEfxQaZ0B0krk0pXsQir/+VDGVTrA40w2NAQQSFCZ3IvblqP0WBnygtuN1WHNLSGB On1TQdp7aLONwLY9BPio0eK/ac4GnzTVXzZGKyBiNSgTV3LBdNiQZyVrgvGsZAVUyx9e 8Uyea8ks6EFy8sIV0dLa12QQ/woXbJzhtgqJKO/cIJsI3ENDmAaiYzz91ttF4E1P95xt k8zHmRAYVw0zWbP0WAkydcsQSwOhKHpGGt7oXDloxfrqkNGvTTkqisvZ3y/fy6+B7jKi B5wg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-184586-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-184586-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id a640c23a62f3a-a61c2bb6a32si164466266b.42.2024.05.21.00.44.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 May 2024 00:44:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-184586-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-184586-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-184586-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id CAA5C1F22135 for ; Tue, 21 May 2024 07:44:28 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AD74351C5C; Tue, 21 May 2024 07:44:23 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6DEFC5466C; Tue, 21 May 2024 07:44:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716277463; cv=none; b=Z/9Fj3E3ekhV/8zSlzcb+zNbTx1p6iFx9AkwzdVxkQoa3n8esOIFJuuZBrqhZ9zWqa4aqZUFplvDtZKpMK+E3qLPzcvEtiDTs7/205vyw2395h22LX76YEQMXx4sqYiVbSHtJ4LnqMPQNXG7F/NSjgK1dDTDWW1TaGvO36kov7g= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716277463; c=relaxed/simple; bh=12ORrgVkQoBujtx3I4EyW1vH6oJF0P0A90rYX72bXiM=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=WqMb5k0OUZrRaeC/BlTu/wRnrCPZqtSEfgjMrBugdlm7WO3KOE+qMyzUQzE0COigqa79a1bmUJOvlgAhCIjT+cL6lw46WGWoa7PLZYv7x8PW78cuYKsFNtQSGqxDqLjuQVCJSjlmw6imwDOkLAFEoxCto2N1BCxUpaoc+0fV/Kg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com 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 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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(-) -- 2.34.1