From patchwork Mon Aug 26 14:53:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Pankaj Raghav (Samsung)" X-Patchwork-Id: 13778002 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 0238AC5321D for ; Mon, 26 Aug 2024 14:53:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7F1606B0083; Mon, 26 Aug 2024 10:53:56 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7A2016B0085; Mon, 26 Aug 2024 10:53:56 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 669356B0088; Mon, 26 Aug 2024 10:53:56 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 49AE16B0083 for ; Mon, 26 Aug 2024 10:53:56 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id E950C1A11B0 for ; Mon, 26 Aug 2024 14:53:55 +0000 (UTC) X-FDA: 82494691230.04.543F1FC Received: from mout-p-202.mailbox.org (mout-p-202.mailbox.org [80.241.56.172]) by imf03.hostedemail.com (Postfix) with ESMTP id 1EDDD20021 for ; Mon, 26 Aug 2024 14:53:52 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=pankajraghav.com header.s=MBO0001 header.b=dzt1yLro; dmarc=pass (policy=quarantine) header.from=pankajraghav.com; spf=pass (imf03.hostedemail.com: domain of kernel@pankajraghav.com designates 80.241.56.172 as permitted sender) smtp.mailfrom=kernel@pankajraghav.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1724683970; a=rsa-sha256; cv=none; b=MzdMf69nJWiS/463Haw1IUMvjUAgIWJ1uDIlqxM00dAVhN11vNCmXmEKPojVMrU9SzEn74 pagTA3Md7VolpsHA7DeSQD/wfSYDBQbsxKi1iMY3mAfuBXNwl9HgAmRnitpM5hcAuokjK1 b2dMpFYFdZLX4qjxy4nWmvw1sXosIVk= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=pankajraghav.com header.s=MBO0001 header.b=dzt1yLro; dmarc=pass (policy=quarantine) header.from=pankajraghav.com; spf=pass (imf03.hostedemail.com: domain of kernel@pankajraghav.com designates 80.241.56.172 as permitted sender) smtp.mailfrom=kernel@pankajraghav.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1724683970; 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:dkim-signature; bh=1BUU84NCaopG37WJwAhGnNRn9/jXFpZdy15jON8+/EM=; b=cxhwgK1IIipRzTmD6/bjfSISSrq1gPUtBwpBol0S8DrO9NIsz2ruJ+LOP5xMItfJouWQR3 h+AsBZXkj6PQqN7cbS24yRv1HLYVYAevjffCgk7hzt5FARjNqX7NKnDiqlvVLLGnlgGSLJ yuj91BuW/KDcy1rqNi4TNQ977GurCUE= Received: from smtp1.mailbox.org (smtp1.mailbox.org [IPv6:2001:67c:2050:b231:465::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-202.mailbox.org (Postfix) with ESMTPS id 4WstwW6tYFz9sWF; Mon, 26 Aug 2024 16:53:47 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pankajraghav.com; s=MBO0001; t=1724684028; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=1BUU84NCaopG37WJwAhGnNRn9/jXFpZdy15jON8+/EM=; b=dzt1yLrodmnTfBTi3WoZgGDVg3UBX+THnChaCmDBi02M8ZETbF9uP3m75N7xQXbauyW32X B62UfHa78bSX6JKpHexdH8I6Lno8mEuf2INf4gf4j6reAn/+7MdTEI+7XZCd/3Q0EdtI82 aqD+0556kofYsW46UmOxbVJlr7ltztrwpkqGbnXQSy1abMtMOBvqGsqTvfJwA1EL8BpaI7 DiSPpnE+L7UvPIbLMtcdPkfK6ef297omVGGNF+pKt9MrPTpa6U3uYOqzIYFY3qb2vwwcj4 LsNTJ1v58ts+up3ZncfYD2XO6KaWOXkfncyCkenJf1lTXo8SFrJXRVTqWsNjsA== From: "Pankaj Raghav (Samsung)" To: Shuah Khan , Andrew Morton Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, mcgrof@kernel.org, gost.dev@samsung.com, linux-kselftest@vger.kernel.org, kernel@pankajraghav.com, Zi Yan , Pankaj Raghav Subject: [PATCH] selftests/mm: do not try to split below filesystem block size Date: Mon, 26 Aug 2024 16:53:44 +0200 Message-ID: <20240826145344.33665-1-kernel@pankajraghav.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 1EDDD20021 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: inom68mhaajeafcxebxtzxfhrtgecnj1 X-HE-Tag: 1724684032-239549 X-HE-Meta: U2FsdGVkX19vHSwcVegZ/An8mmaWG60U6L1bZYlBSA/eAp7DytAFAL1anFmFV4VCBFM1/s5pqvraKgJDodRVUvpYNASwVwleGxysX/R+vLGAujjlCEKHLzMQBk09bERCvuMtsJUBnMlcxjeojMNDNwCMCssalcnu+czWoVv1jwA9SEsWff6z3vDgmYcg4lrTLApXX9pwviF0p58LBYFhcS/lrcqKLsWbVSWTk3VbGMIOQDlZ6rt15f6RYZTcRVyXd2KyUfUxOIuYCuAi9lzQU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qHO0ZT5SYNoDo7g== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: From: Pankaj Raghav There is no point trying to split pagecache thp below the blocksize of the filesystem as that is the minimum order that pagecache needs to maintain to support blocksizes greater than pagesize [1]. Set the lower limit for the splitting order to be the fs blocksize order. As the number of tests will now depend on the minimum splitting order, move the file preparation before calling ksft_set_plan(). [1] https://lore.kernel.org/linux-fsdevel/20240822135018.1931258-1-kernel@pankajraghav.com/ Signed-off-by: Pankaj Raghav --- .../selftests/mm/split_huge_page_test.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) base-commit: 5771112c37523a2344b346d7fe613694a2566df9 diff --git a/tools/testing/selftests/mm/split_huge_page_test.c b/tools/testing/selftests/mm/split_huge_page_test.c index e5e8dafc9d94..187fe9107998 100644 --- a/tools/testing/selftests/mm/split_huge_page_test.c +++ b/tools/testing/selftests/mm/split_huge_page_test.c @@ -9,11 +9,13 @@ #include #include #include +#include #include #include #include #include #include +#include #include #include #include @@ -404,9 +406,10 @@ void split_thp_in_pagecache_to_order(size_t fd_size, int order, const char *fs_l int main(int argc, char **argv) { - int i; + int i, min_split_order = 0; size_t fd_size; char *optional_xfs_path = NULL; + struct stat filestat; char fs_loc_template[] = "/tmp/thp_fs_XXXXXX"; const char *fs_loc; bool created_tmp; @@ -421,8 +424,6 @@ int main(int argc, char **argv) if (argc > 1) optional_xfs_path = argv[1]; - ksft_set_plan(3+9); - pagesize = getpagesize(); pageshift = ffs(pagesize) - 1; pmd_pagesize = read_pmd_pagesize(); @@ -431,13 +432,19 @@ int main(int argc, char **argv) fd_size = 2 * pmd_pagesize; + created_tmp = prepare_thp_fs(optional_xfs_path, fs_loc_template, + &fs_loc); + + if (!stat(fs_loc, &filestat)) + min_split_order = log2(filestat.st_blksize) - pageshift; + + ksft_set_plan(3 + 9 - min_split_order); + split_pmd_thp(); split_pte_mapped_thp(); split_file_backed_thp(); - created_tmp = prepare_thp_fs(optional_xfs_path, fs_loc_template, - &fs_loc); - for (i = 8; i >= 0; i--) + for (i = 8; i >= min_split_order; i--) split_thp_in_pagecache_to_order(fd_size, i, fs_loc); cleanup_thp_fs(fs_loc, created_tmp);