public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH v2 0/3] new test for madvise(MADV_DONTNEED)
@ 2022-10-11 12:16 Zhao Gongyi via ltp
  2022-10-11 12:16 ` [LTP] [PATCH v2 1/3] syscalls/madvise03: " Zhao Gongyi via ltp
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Zhao Gongyi via ltp @ 2022-10-11 12:16 UTC (permalink / raw)
  To: ltp

1. verify that after a successful MADV_DONTNEED operation, it will
   result in zero-fill-on-demand pages for anonymous private mappings.
2. Test cases for madvise(2) system call, verify that MADV_DONTNEED
   cannot be applied to Huge TLB pages.
3. Verify that when MADV_DONTNEED applied to shared mappings, it will
   lead to the resident set size(RSS) of the calling process reduced
   immediately.

Changes in v2:
  - Modify the test adn split the test into two as suggestion
  - Add a new test for madvise

Zhao Gongyi (3):
  syscalls/madvise03: new test for madvise(MADV_DONTNEED)
  syscalls/madvise04: new test for madvise(MADV_DONTNEED)
  syscalls/madvise11: new test for madvise(MADV_DONTNEED)

 runtest/syscalls                              |  3 +
 testcases/kernel/syscalls/madvise/.gitignore  |  3 +
 testcases/kernel/syscalls/madvise/madvise03.c | 69 ++++++++++++++++
 testcases/kernel/syscalls/madvise/madvise04.c | 48 ++++++++++++
 testcases/kernel/syscalls/madvise/madvise11.c | 78 +++++++++++++++++++
 5 files changed, 201 insertions(+)
 create mode 100644 testcases/kernel/syscalls/madvise/madvise03.c
 create mode 100644 testcases/kernel/syscalls/madvise/madvise04.c
 create mode 100644 testcases/kernel/syscalls/madvise/madvise11.c

--
2.17.1


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

^ permalink raw reply	[flat|nested] 8+ messages in thread
* Re: [LTP] [PATCH v2 3/3] syscalls/madvise11: new test for madvise(MADV_DONTNEED)
@ 2022-10-12  8:56 zhaogongyi via ltp
  0 siblings, 0 replies; 8+ messages in thread
From: zhaogongyi via ltp @ 2022-10-12  8:56 UTC (permalink / raw)
  To: Cyril Hrubis; +Cc: ltp@lists.linux.it

Hi,

> 
> Hi!
> > +static void run(void)
> > +{
> > +	char cmd[BUF_SIZE];
> > +	char line[BUF_SIZE];
> > +	char vm_area_addr[128];
> > +
> > +	TEST(madvise(addr, MAP_SIZE, MADV_DONTNEED));
> > +	if (TST_RET == -1) {
> > +		tst_brk(TBROK | TTERRNO, "madvise(%p, %d, 0x%x)",
> > +			addr, MAP_SIZE, MADV_DONTNEED);
> > +	}
> > +
> > +	sprintf(vm_area_addr, "%p", addr);
> > +	sprintf(cmd,
> > +		"cat /proc/%d/smaps | grep %s -A 4 | grep Rss: | grep '0 kB'",
> > +		getpid(), &(vm_area_addr[2]));
> 
> This is way too ugly and may break easily too.
> 
> If we are going to parse the file we should do it properly in C instead.
> Why can't we just read the file line by line until we find the right address
> at the start of the line and once we do look for the Rss?


I have do it with C at first, but it seems not intuitive. I will change back on next version of the patch.

Regards,
Gongyi 


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

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

end of thread, other threads:[~2022-10-12  8:57 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-11 12:16 [LTP] [PATCH v2 0/3] new test for madvise(MADV_DONTNEED) Zhao Gongyi via ltp
2022-10-11 12:16 ` [LTP] [PATCH v2 1/3] syscalls/madvise03: " Zhao Gongyi via ltp
2022-10-11 14:25   ` Cyril Hrubis
2022-10-11 12:16 ` [LTP] [PATCH v2 2/3] syscalls/madvise04: " Zhao Gongyi via ltp
2022-10-11 14:29   ` Cyril Hrubis
2022-10-11 12:16 ` [LTP] [PATCH v2 3/3] syscalls/madvise11: " Zhao Gongyi via ltp
2022-10-12  8:52   ` Cyril Hrubis
  -- strict thread matches above, loose matches on Subject: below --
2022-10-12  8:56 zhaogongyi via ltp

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