public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Richard Palethorpe <rpalethorpe@suse.de>
To: Andrea Cervesato <andrea.cervesato@suse.com>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v1 3/3] Add process_madvise03 test
Date: Tue, 18 Oct 2022 13:49:23 +0100	[thread overview]
Message-ID: <871qr5jnoh.fsf@suse.de> (raw)
In-Reply-To: <875yghjo11.fsf@suse.de>


Richard Palethorpe <rpalethorpe@suse.de> writes:

> Hello,
>
> Andrea Cervesato via ltp <ltp@lists.linux.it> writes:
>
>> Test for checking MADV_PAGEOUT functionality over memory-mapped file
>> in process_madvise syscall.
>
> So this one doesn't need swap, but it has some other issues.
>
>>
>> Signed-off-by: Andrea Cervesato <andrea.cervesato@suse.com>
>> ---
>>  testcases/kernel/syscalls/cma/.gitignore      |   1 +
>>  .../kernel/syscalls/cma/process_madvise03.c   | 139 ++++++++++++++++++
>>  2 files changed, 140 insertions(+)
>>  create mode 100644 testcases/kernel/syscalls/cma/process_madvise03.c
>>
>> diff --git a/testcases/kernel/syscalls/cma/.gitignore b/testcases/kernel/syscalls/cma/.gitignore
>> index 47ae3e445..147b03c48 100644
>> --- a/testcases/kernel/syscalls/cma/.gitignore
>> +++ b/testcases/kernel/syscalls/cma/.gitignore
>> @@ -4,3 +4,4 @@
>>  /process_vm_writev02
>>  /process_madvise01
>>  /process_madvise02
>> +/process_madvise03
>> diff --git a/testcases/kernel/syscalls/cma/process_madvise03.c b/testcases/kernel/syscalls/cma/process_madvise03.c
>> new file mode 100644
>> index 000000000..3f12ef530
>> --- /dev/null
>> +++ b/testcases/kernel/syscalls/cma/process_madvise03.c
>> @@ -0,0 +1,139 @@
>> +// SPDX-License-Identifier: GPL-2.0-or-later
>> +/*
>> + * Copyright (C) 2022 SUSE LLC Andrea Cervesato <andrea.cervesato@suse.com>
>> + */
>> +
>> +/*\
>> + * [Description]
>> + *
>> + * Spawn child inside cgroup and set max memory. Allocate file-backed memory
>> + * pages inside child and reclaim it with MADV_PAGEOUT. Then check if memory
>> + * pages have been written back to the backing storage.

Actually, one more thing. You don't check if it has been written to the
backing store and it's quite hard to check for this.

At best you could reopen the file in the parent and check the contents
are correct. Otherwise it requires checking the page cache has been
discarded using a side channel (e.g. timing loads).

So I would just not bother for this test.

Also process_madvise returns the number of bytes *advised* not what was
actually reclaimed. Even that is not guaranteed to be the same as the
amount requested.

-- 
Thank you,
Richard.

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

      reply	other threads:[~2022-10-18 12:56 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-06 11:06 [LTP] [PATCH v1 0/3] Add process_madvise support Andrea Cervesato via ltp
2022-10-06 11:06 ` [LTP] [PATCH v1 1/3] Add process_madvise01 test Andrea Cervesato via ltp
2022-10-18 11:51   ` Richard Palethorpe
2022-10-06 11:06 ` [LTP] [PATCH v1] Rewrite process_vm01 test using new LTP API Andrea Cervesato via ltp
2022-10-06 11:10   ` Andrea Cervesato via ltp
2022-10-06 11:06 ` [LTP] [PATCH v1 2/3] Add process_madvise02 test Andrea Cervesato via ltp
2022-10-18 12:24   ` Richard Palethorpe
2022-10-26  7:50     ` Andrea Cervesato via ltp
2022-10-06 11:06 ` [LTP] [PATCH v1 3/3] Add process_madvise03 test Andrea Cervesato via ltp
2022-10-18 12:29   ` Richard Palethorpe
2022-10-18 12:49     ` Richard Palethorpe [this message]

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=871qr5jnoh.fsf@suse.de \
    --to=rpalethorpe@suse.de \
    --cc=andrea.cervesato@suse.com \
    --cc=ltp@lists.linux.it \
    /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