From: Zi Yan <ziy@nvidia.com>
To: Aishwarya TCV <aishwarya.tcv@arm.com>
Cc: "\"Pankaj Raghav (Samsung)\"" <kernel@pankajraghav.com>,
linux-mm@kvack.org,
"\"Matthew Wilcox (Oracle)\"" <willy@infradead.org>,
"David Hildenbrand" <david@redhat.com>,
"Yang Shi" <shy828301@gmail.com>, "Yu Zhao" <yuzhao@google.com>,
"\"Kirill A . Shutemov\"" <kirill.shutemov@linux.intel.com>,
"Ryan Roberts" <ryan.roberts@arm.com>,
"\"Michal Koutný\"" <mkoutny@suse.com>,
"Roman Gushchin" <roman.gushchin@linux.dev>,
"\"Zach O'Keefe\"" <zokeefe@google.com>,
"Hugh Dickins" <hughd@google.com>,
"Luis Chamberlain" <mcgrof@kernel.org>,
"Andrew Morton" <akpm@linux-foundation.org>,
linux-kernel@vger.kernel.org, cgroups@vger.kernel.org,
linux-fsdevel@vger.kernel.org, linux-kselftest@vger.kernel.org,
"Mark Brown" <broonie@kernel.org>
Subject: Re: [PATCH v5 8/8] mm: huge_memory: enable debugfs to split huge pages to any order.
Date: Fri, 01 Mar 2024 14:37:22 -0500 [thread overview]
Message-ID: <A111EB95-0AF5-4715-82A4-70B8AD900A93@nvidia.com> (raw)
In-Reply-To: <082e48c8-71b7-4937-a5da-7a37b4be16ba@arm.com>
[-- Attachment #1.1: Type: text/plain, Size: 1248 bytes --]
On 1 Mar 2024, at 4:51, Aishwarya TCV wrote:
> On 26/02/2024 20:55, Zi Yan wrote:
>> From: Zi Yan <ziy@nvidia.com>
>>
>> It is used to test split_huge_page_to_list_to_order for pagecache THPs.
>> Also add test cases for split_huge_page_to_list_to_order via both
>> debugfs.
>>
>> Signed-off-by: Zi Yan <ziy@nvidia.com>
>> ---
>> mm/huge_memory.c | 34 ++++--
>> .../selftests/mm/split_huge_page_test.c | 115 +++++++++++++++++-
>> 2 files changed, 131 insertions(+), 18 deletions(-)
>>
>
> Hi Zi,
>
> When booting the kernel against next-master(20240228)with Arm64 on
> Marvell Thunder X2 (TX2), the kselftest-mm test 'split_huge_page_test'
> is failing in our CI (with rootfs over NFS). I can send the full logs if
> required.
>
> A bisect (full log below) identified this patch as introducing the
> failure. Bisected it on the tag "next-20240228" at repo
> "https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git".
>
> This works fine on Linux version 6.8.0-rc6
Hi Aishwarya,
Can you try the attached patch and see if it fixes the failure? I changed
the test to accept XFS dev as input, mount XFS on a temp folder under /tmp,
and skip if no XFS is mounted.
Thanks.
--
Best Regards,
Yan, Zi
[-- Attachment #1.2: selftest.patch --]
[-- Type: text/plain, Size: 4892 bytes --]
diff --git a/tools/testing/selftests/mm/split_huge_page_test.c b/tools/testing/selftests/mm/split_huge_page_test.c
index cf09fdc9ef22..047883473b84 100644
--- a/tools/testing/selftests/mm/split_huge_page_test.c
+++ b/tools/testing/selftests/mm/split_huge_page_test.c
@@ -26,7 +26,6 @@ uint64_t pmd_pagesize;
#define SPLIT_DEBUGFS "/sys/kernel/debug/split_huge_pages"
#define SMAP_PATH "/proc/self/smaps"
-#define THP_FS_PATH "/mnt/thp_fs"
#define INPUT_MAX 80
#define PID_FMT "%d,0x%lx,0x%lx,%d"
@@ -268,7 +267,45 @@ void split_file_backed_thp(void)
ksft_exit_fail_msg("Error occurred\n");
}
-void create_pagecache_thp_and_fd(const char *testfile, size_t fd_size, int *fd, char **addr)
+bool prepare_thp_fs(const char *xfs_dev_loc, char *thp_fs_template,
+ const char **thp_fs_loc)
+{
+ bool mounted = false;
+
+ *thp_fs_loc = mkdtemp(thp_fs_template);
+
+ if (!*thp_fs_loc)
+ ksft_exit_fail_msg("cannot create temp folder\n");
+
+ if (xfs_dev_loc) {
+ int status = mount(xfs_dev_loc, *thp_fs_loc, "xfs", 0, NULL);
+
+ if (status)
+ ksft_exit_fail_msg("Unable to mount xfs for testing\n");
+ mounted = true;
+ }
+ return mounted;
+}
+
+void cleanup_thp_fs(const char *thp_fs_loc, bool mounted)
+{
+ int status;
+
+ if (mounted) {
+ status = umount(thp_fs_loc);
+ if (status)
+ ksft_exit_fail_msg("Unable to umount %s\n",
+ thp_fs_loc);
+ }
+
+ status = rmdir(thp_fs_loc);
+ if (status)
+ ksft_exit_fail_msg("cannot remove tmp dir: %s\n",
+ strerror(errno));
+}
+
+int create_pagecache_thp_and_fd(const char *testfile, size_t fd_size, int *fd,
+ char **addr)
{
size_t i;
int dummy;
@@ -277,7 +314,7 @@ void create_pagecache_thp_and_fd(const char *testfile, size_t fd_size, int *fd,
*fd = open(testfile, O_CREAT | O_RDWR, 0664);
if (*fd == -1)
- ksft_exit_fail_msg("Failed to create a file at "THP_FS_PATH);
+ ksft_exit_fail_msg("Failed to create a file at %s\n", testfile);
for (i = 0; i < fd_size; i++) {
unsigned char byte = (unsigned char)i;
@@ -299,7 +336,7 @@ void create_pagecache_thp_and_fd(const char *testfile, size_t fd_size, int *fd,
*fd = open(testfile, O_RDWR);
if (*fd == -1) {
- ksft_perror("Failed to open a file at "THP_FS_PATH);
+ ksft_perror("Failed to open testfile\n");
goto err_out_unlink;
}
@@ -314,26 +351,37 @@ void create_pagecache_thp_and_fd(const char *testfile, size_t fd_size, int *fd,
dummy += *(*addr + i);
if (!check_huge_file(*addr, fd_size / pmd_pagesize, pmd_pagesize)) {
- ksft_print_msg("No large pagecache folio generated, please mount a filesystem supporting large folio at "THP_FS_PATH"\n");
- goto err_out_close;
+ ksft_print_msg("No large pagecache folio generated, please provide a filesystem supporting large folio\n");
+ unlink(testfile);
+ ksft_test_result_skip("Pagecache folio split skipped\n");
+ return -2;
}
- return;
+ return 0;
err_out_close:
close(*fd);
err_out_unlink:
unlink(testfile);
ksft_exit_fail_msg("Failed to create large pagecache folios\n");
+ return -1;
}
-void split_thp_in_pagecache_to_order(size_t fd_size, int order)
+void split_thp_in_pagecache_to_order(size_t fd_size, int order, const char *fs_loc)
{
int fd;
char *addr;
size_t i;
- const char testfile[] = THP_FS_PATH "/test";
+ char testfile[INPUT_MAX];
int err = 0;
- create_pagecache_thp_and_fd(testfile, fd_size, &fd, &addr);
+ err = snprintf(testfile, INPUT_MAX, "%s/test", fs_loc);
+
+ if (err < 0)
+ ksft_exit_fail_msg("cannot generate right test file name\n");
+
+ err = create_pagecache_thp_and_fd(testfile, fd_size, &fd, &addr);
+ if (err)
+ return;
+ err = 0;
write_debugfs(PID_FMT, getpid(), (uint64_t)addr, (uint64_t)addr + fd_size, order);
@@ -351,6 +399,7 @@ void split_thp_in_pagecache_to_order(size_t fd_size, int order)
}
out:
+ munmap(addr, fd_size);
close(fd);
unlink(testfile);
if (err)
@@ -360,8 +409,11 @@ void split_thp_in_pagecache_to_order(size_t fd_size, int order)
int main(int argc, char **argv)
{
- int i;
+ int i, mounted;
size_t fd_size;
+ char *optional_xfs_dev_loc = NULL;
+ char fs_loc_template[] = "/tmp/thp_fs_XXXXXX";
+ const char *fs_loc;
ksft_print_header();
@@ -370,6 +422,9 @@ int main(int argc, char **argv)
ksft_finished();
}
+ if (argc > 1)
+ optional_xfs_dev_loc = argv[1];
+
ksft_set_plan(3+9);
pagesize = getpagesize();
@@ -384,8 +439,11 @@ int main(int argc, char **argv)
split_pte_mapped_thp();
split_file_backed_thp();
+ mounted = prepare_thp_fs(optional_xfs_dev_loc, fs_loc_template,
+ &fs_loc);
for (i = 8; i >= 0; i--)
- split_thp_in_pagecache_to_order(fd_size, i);
+ split_thp_in_pagecache_to_order(fd_size, i, fs_loc);
+ cleanup_thp_fs(fs_loc, mounted);
ksft_finished();
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 854 bytes --]
next prev parent reply other threads:[~2024-03-01 19:37 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-26 20:55 [PATCH v5 0/8] Split a folio to any lower order folios Zi Yan
2024-02-26 20:55 ` [PATCH v5 1/8] mm/huge_memory: only split PMD mapping when necessary in unmap_folio() Zi Yan
2024-02-28 10:30 ` David Hildenbrand
2024-02-26 20:55 ` [PATCH v5 2/8] mm: Support order-1 folios in the page cache Zi Yan
2024-02-26 20:55 ` [PATCH v5 3/8] mm/memcg: use order instead of nr in split_page_memcg() Zi Yan
2024-02-26 20:55 ` [PATCH v5 4/8] mm/page_owner: use order instead of nr in split_page_owner() Zi Yan
2024-02-26 20:55 ` [PATCH v5 5/8] mm: memcg: make memcg huge page split support any order split Zi Yan
2024-02-26 20:55 ` [PATCH v5 6/8] mm: page_owner: add support for splitting to any order in split page_owner Zi Yan
2024-02-28 10:31 ` David Hildenbrand
2024-02-26 20:55 ` [PATCH v5 7/8] mm: thp: split huge page to any lower order pages Zi Yan
2024-02-28 8:23 ` Ryan Roberts
2024-02-28 15:42 ` Zi Yan
2024-02-28 15:44 ` Ryan Roberts
2024-02-28 15:52 ` Zi Yan
2024-03-07 14:58 ` Zi Yan
2024-02-26 20:55 ` [PATCH v5 8/8] mm: huge_memory: enable debugfs to split huge pages to any order Zi Yan
2024-03-01 9:51 ` Aishwarya TCV
2024-03-01 10:33 ` Ryan Roberts
2024-03-01 12:11 ` Mark Brown
2024-03-01 12:56 ` Zi Yan
2024-03-01 14:14 ` Mark Brown
2024-03-01 12:52 ` Zi Yan
2024-03-01 13:09 ` Ryan Roberts
2024-03-01 13:53 ` Zi Yan
2024-03-01 14:18 ` Ryan Roberts
2024-03-01 14:27 ` Mark Brown
2024-03-01 15:21 ` Zi Yan
2024-03-01 19:41 ` Zi Yan
2024-03-01 14:24 ` Mark Brown
2024-03-01 14:00 ` Zi Yan
2024-03-01 14:23 ` Ryan Roberts
2024-03-01 14:33 ` Zi Yan
2024-03-01 19:37 ` Zi Yan [this message]
2024-03-01 20:02 ` Zi Yan
2024-03-01 21:10 ` Zi Yan
2024-03-04 9:50 ` Aishwarya TCV
2024-03-04 14:58 ` Zi Yan
2024-03-04 15:44 ` Aishwarya TCV
2024-03-04 15:57 ` Zi Yan
2024-03-04 18:25 ` Aishwarya TCV
2024-03-04 18:26 ` Zi Yan
2024-03-04 18:31 ` Zi Yan
2024-03-07 15:06 ` Zi Yan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=A111EB95-0AF5-4715-82A4-70B8AD900A93@nvidia.com \
--to=ziy@nvidia.com \
--cc=aishwarya.tcv@arm.com \
--cc=akpm@linux-foundation.org \
--cc=broonie@kernel.org \
--cc=cgroups@vger.kernel.org \
--cc=david@redhat.com \
--cc=hughd@google.com \
--cc=kernel@pankajraghav.com \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mcgrof@kernel.org \
--cc=mkoutny@suse.com \
--cc=roman.gushchin@linux.dev \
--cc=ryan.roberts@arm.com \
--cc=shy828301@gmail.com \
--cc=willy@infradead.org \
--cc=yuzhao@google.com \
--cc=zokeefe@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).