public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH v2 1/1] cachestat01: Reduce required space on 64kb page size
@ 2024-07-31  7:34 Petr Vorel
  2024-07-31 10:32 ` Cyril Hrubis
  0 siblings, 1 reply; 7+ messages in thread
From: Petr Vorel @ 2024-07-31  7:34 UTC (permalink / raw)
  To: ltp

ppc64le (6.10.1 on Tumbleweed) fails due 64kb page size requiring more
space:

cachestat01.c:39: TINFO: Number of pages: 4096
cachestat01.c:56: TPASS: cachestat(fd, cs_range, cs, 0) passed
cachestat01.c:59: TPASS: cs->nr_cache + cs->nr_evicted == num_pages (4096)
cachestat01.c:38: TINFO: Disable file synchronization
cachestat01.c:39: TINFO: Number of pages: 8192
cachestat01.c:46: TBROK: write(3,0x1000ddb0aa0,65536) failed: ENOSPC (28)

Therefore use calculation, which enables maximum number of pages 1 << 15
only for 4kb page size, for 64kb set the maximum number of pages 1 << 12
(13 would trigger ENOSPC on XFS and Btrfs).

Fixes: 93b28ee69d ("Add cachestat01 test")
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
changes v1->v2:
* calculate number of pages (or more precisely calculate the shift)
@Cyril: I'm not sure, if you like it this way, feel free to further
improve.

v1:
https://patchwork.ozlabs.org/project/ltp/patch/20240729223431.1307306-1-pvorel@suse.cz/
https://lore.kernel.org/ltp/20240729223431.1307306-1-pvorel@suse.cz/

Kind regards,
Petr

 testcases/kernel/syscalls/cachestat/cachestat01.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/testcases/kernel/syscalls/cachestat/cachestat01.c b/testcases/kernel/syscalls/cachestat/cachestat01.c
index f7f6275cbd..287a67f544 100644
--- a/testcases/kernel/syscalls/cachestat/cachestat01.c
+++ b/testcases/kernel/syscalls/cachestat/cachestat01.c
@@ -26,7 +26,7 @@
 #define MNTPOINT "mntpoint"
 #define FILENAME MNTPOINT "/myfile.bin"
 
-static int page_size;
+static int page_size, num_shift;
 static char *page_data;
 static struct cachestat *cs;
 static struct cachestat_range *cs_range;
@@ -67,14 +67,14 @@ static void test_cached_pages(const unsigned int use_sync, const int num_pages)
 
 static void run(unsigned int use_sync)
 {
-	for (int i = 0; i < 15; i++)
+	for (int i = 0; i < num_shift; i++)
 		test_cached_pages(use_sync, 1 << i);
 }
 
 static void setup(void)
 {
 	page_size = (int)sysconf(_SC_PAGESIZE);
-
+	num_shift = MIN(tst_device->size*1024*2.6/page_size, 15);
 	page_data = SAFE_MALLOC(page_size);
 	memset(page_data, 'a', page_size);
 }
-- 
2.45.2


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2024-10-18  7:51 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-31  7:34 [LTP] [PATCH v2 1/1] cachestat01: Reduce required space on 64kb page size Petr Vorel
2024-07-31 10:32 ` Cyril Hrubis
2024-07-31 10:39   ` Cyril Hrubis
2024-07-31 19:30     ` Petr Vorel
2024-08-01  9:00       ` Cyril Hrubis
2024-08-01  9:14         ` Petr Vorel
2024-10-18  7:50           ` Hongchen Zhang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox