* [PATCH] selftests/mm: do not try to split below filesystem block size
@ 2024-08-26 14:53 Pankaj Raghav (Samsung)
2024-08-26 14:59 ` Zi Yan
0 siblings, 1 reply; 3+ messages in thread
From: Pankaj Raghav (Samsung) @ 2024-08-26 14:53 UTC (permalink / raw)
To: Shuah Khan, Andrew Morton
Cc: linux-kernel, linux-mm, mcgrof, gost.dev, linux-kselftest,
kernel, Zi Yan, Pankaj Raghav
From: Pankaj Raghav <p.raghav@samsung.com>
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 <p.raghav@samsung.com>
---
.../selftests/mm/split_huge_page_test.c | 19 +++++++++++++------
1 file changed, 13 insertions(+), 6 deletions(-)
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 <stdlib.h>
#include <stdarg.h>
#include <unistd.h>
+#include <math.h>
#include <inttypes.h>
#include <string.h>
#include <fcntl.h>
#include <sys/mman.h>
#include <sys/mount.h>
+#include <sys/stat.h>
#include <malloc.h>
#include <stdbool.h>
#include <time.h>
@@ -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);
base-commit: 5771112c37523a2344b346d7fe613694a2566df9
--
2.44.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] selftests/mm: do not try to split below filesystem block size
2024-08-26 14:53 [PATCH] selftests/mm: do not try to split below filesystem block size Pankaj Raghav (Samsung)
@ 2024-08-26 14:59 ` Zi Yan
2024-08-26 15:01 ` Pankaj Raghav (Samsung)
0 siblings, 1 reply; 3+ messages in thread
From: Zi Yan @ 2024-08-26 14:59 UTC (permalink / raw)
To: Pankaj Raghav (Samsung)
Cc: Shuah Khan, Andrew Morton, linux-kernel, linux-mm, mcgrof,
gost.dev, linux-kselftest, Pankaj Raghav
[-- Attachment #1: Type: text/plain, Size: 1103 bytes --]
On 26 Aug 2024, at 10:53, Pankaj Raghav (Samsung) wrote:
> From: Pankaj Raghav <p.raghav@samsung.com>
>
> 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].
But the purpose of the tests is to make sure all cases are properly handled,
right? If we do not test splitting pagecache large folio below the
block size, we will never know if a kernel change breaks the handling.
Just my two cents.
>
> 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 <p.raghav@samsung.com>
> ---
> .../selftests/mm/split_huge_page_test.c | 19 +++++++++++++------
> 1 file changed, 13 insertions(+), 6 deletions(-)
--
Best Regards,
Yan, Zi
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 854 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] selftests/mm: do not try to split below filesystem block size
2024-08-26 14:59 ` Zi Yan
@ 2024-08-26 15:01 ` Pankaj Raghav (Samsung)
0 siblings, 0 replies; 3+ messages in thread
From: Pankaj Raghav (Samsung) @ 2024-08-26 15:01 UTC (permalink / raw)
To: Zi Yan
Cc: Shuah Khan, Andrew Morton, linux-kernel, linux-mm, mcgrof,
gost.dev, linux-kselftest, Pankaj Raghav
On Mon, Aug 26, 2024 at 10:59:16AM -0400, Zi Yan wrote:
> On 26 Aug 2024, at 10:53, Pankaj Raghav (Samsung) wrote:
>
> > From: Pankaj Raghav <p.raghav@samsung.com>
> >
> > 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].
>
> But the purpose of the tests is to make sure all cases are properly handled,
> right? If we do not test splitting pagecache large folio below the
> block size, we will never know if a kernel change breaks the handling.
>
> Just my two cents.
That is a fair point. Let's ignore this patch then :)
>
> >
> > 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 <p.raghav@samsung.com>
> > ---
> > .../selftests/mm/split_huge_page_test.c | 19 +++++++++++++------
> > 1 file changed, 13 insertions(+), 6 deletions(-)
>
>
> --
> Best Regards,
> Yan, Zi
--
Pankaj Raghav
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-08-26 15:01 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-08-26 14:53 [PATCH] selftests/mm: do not try to split below filesystem block size Pankaj Raghav (Samsung)
2024-08-26 14:59 ` Zi Yan
2024-08-26 15:01 ` Pankaj Raghav (Samsung)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox