From: Stefan Roesch <shr@devkernel.io>
To: Petr Vorel <pvorel@suse.cz>
Cc: david@redhat.com, linux-mm@kvack.org, oliver.sang@intel.com,
kernel-team@fb.com, ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v1] mem: disable KSM smart scan for ksm tests
Date: Fri, 01 Dec 2023 12:11:38 -0800 [thread overview]
Message-ID: <87zfyt4r8t.fsf@devkernel.io> (raw)
In-Reply-To: <20231129101010.GA535399@pevik>
Petr Vorel <pvorel@suse.cz> writes:
>> On Wed, Nov 29, 2023 at 12:51 AM Petr Vorel <pvorel@suse.cz> wrote:
>
>> > Hi Stefan, Li,
>
>> > > Hi Stefan, Petr,
>
>> > > On Tue, Nov 28, 2023 at 3:46 PM Petr Vorel <pvorel@suse.cz> wrote:
>
>> > > > Hi Stefan,
>
>> > > > > This disables the "smart scan" KSM feature to make sure that the
>> > volatile
>> > > > > count remains at 0.
>
>> > > > > Signed-off-by: Stefan Roesch <devkernel.io>
>> > > > nit: you forgot 'shr@'
>> > > > Signed-off-by: Stefan Roesch <shr@devkernel.io>
>
>> > > > > Reported-by: kernel test robot <oliver.sang@intel.com>
>> > > > > Closes:
>
>> > https://lore.kernel.org/oe-lkp/202311161132.13d8ce5a-oliver.sang@intel.com
>> > > > > ---
>> > > > > testcases/kernel/mem/lib/mem.c | 4 ++++
>> > > > > 1 file changed, 4 insertions(+)
>
>> > > > > diff --git a/testcases/kernel/mem/lib/mem.c
>> > > > b/testcases/kernel/mem/lib/mem.c
>> > > > > index fbfeef026..ef274a3ac 100644
>> > > > > --- a/testcases/kernel/mem/lib/mem.c
>> > > > > +++ b/testcases/kernel/mem/lib/mem.c
>> > > > > @@ -454,6 +454,9 @@ void create_same_memory(int size, int num, int
>> > unit)
>> > > > > {'a', size*MB}, {'a', size*MB}, {'d', size*MB}, {'d',
>> > > > size*MB},
>> > > > > };
>
>> > > > > + /* Disable smart scan for correct volatile counts. */
>> > > > > + SAFE_FILE_PRINTF(PATH_KSM "smart_scan", "0");
>> > > > NOTE, this fails on the systems without /sys/kernel/mm/ksm/smart_scan:
>
>> > > > mem.c:458: TBROK: Failed to open FILE '/sys/kernel/mm/ksm/smart_scan'
>> > for
>> > > > writing: EACCES (13)
>
>> > > > NOTE, we normally handle the setup like this in test setup function.
>
>> > > > But new API has .save_restore which is more robust for tasks like
>> > this.
>> > > > It's already used in ksm01.c, you need just to add this line:
>> > > > {"/sys/kernel/mm/ksm/smart_scan", "0", TST_SR_SKIP},
>
>
>> > > I guess we need to set 'TST_SR_SKIP_MISSING | TST_SR_TBROK_RO'
>> > > as the last field. Because TST_SR_SKIP will continue the test without
>> > > writing '0' to the smart_scan file, that's not correct if the file
>> > exists.
>> > > It will
>> > > ignore a kernel bug (smart_scan can't be written) by that config.
>
>> > > Per the Doc Petr pointed below:
>> > > TST_SR_SKIP_MISSING – Continue without saving the file if it does not
>> > > exist
>> > > TST_SR_TBROK_RO – End test with TBROK if the file is read-only
>> > > TST_SR_SKIP_RO – Continue without saving the file if it is read-only
>> > > TST_SR_SKIP – Equivalent to 'TST_SR_SKIP_MISSING | TST_SR_SKIP_RO'
>
>
>
>> > > > (instead of both SAFE_FILE_PRINTF)
>
>> > > > See:
>
>
>> > https://github.com/linux-test-project/ltp/wiki/C-Test-API#127-saving--restoring-procsys-values
>
>> > > > I wonder if ksm01.c is the only ksm test which needs to disable this.
>
>
>> > > I think all of the ksm0*.c tests should disable it by the config. The
>> > > smart_scan
>> > > will impact all the tests with invoke key function create_same_memory().
>
>> > ksm05.c and ksm06.c does not use create_same_memory(). Or did I overlook
>> > something?
>
>
>> Good catch, I looked into these tests, seems only ksm05 is debatable
>> for disabling smart_scan, as a simple regression, it suggests disabling
>> ksm daemon to avoid disturb according to some workload.
>> https://github.com/linux-test-project/ltp/blob/master/testcases/kernel/mem/ksm/ksm05.c#L30
>
>> ksm06 is definitely need disable smart_scan, it tests KSM in different
>> 'run' state for merge_accros_nodes.
>
> Thanks for having a look.
>
>> To be on the safe side, I would suggest applying the patch to all ksm*
>> tests,
>> and write a new single for smart_scan if needed.
>
> Agree. I vote for new single for smart_scan related test.
>
I'll add a new test.
> Kind regards,
> Petr
--
Mailing list info: https://lists.linux.it/listinfo/ltp
WARNING: multiple messages have this Message-ID (diff)
From: Stefan Roesch <shr@devkernel.io>
To: Petr Vorel <pvorel@suse.cz>
Cc: Li Wang <liwang@redhat.com>,
kernel-team@fb.com, linux-mm@kvack.org, david@redhat.com,
oliver.sang@intel.com, ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v1] mem: disable KSM smart scan for ksm tests
Date: Fri, 01 Dec 2023 12:11:38 -0800 [thread overview]
Message-ID: <87zfyt4r8t.fsf@devkernel.io> (raw)
In-Reply-To: <20231129101010.GA535399@pevik>
Petr Vorel <pvorel@suse.cz> writes:
>> On Wed, Nov 29, 2023 at 12:51 AM Petr Vorel <pvorel@suse.cz> wrote:
>
>> > Hi Stefan, Li,
>
>> > > Hi Stefan, Petr,
>
>> > > On Tue, Nov 28, 2023 at 3:46 PM Petr Vorel <pvorel@suse.cz> wrote:
>
>> > > > Hi Stefan,
>
>> > > > > This disables the "smart scan" KSM feature to make sure that the
>> > volatile
>> > > > > count remains at 0.
>
>> > > > > Signed-off-by: Stefan Roesch <devkernel.io>
>> > > > nit: you forgot 'shr@'
>> > > > Signed-off-by: Stefan Roesch <shr@devkernel.io>
>
>> > > > > Reported-by: kernel test robot <oliver.sang@intel.com>
>> > > > > Closes:
>
>> > https://lore.kernel.org/oe-lkp/202311161132.13d8ce5a-oliver.sang@intel.com
>> > > > > ---
>> > > > > testcases/kernel/mem/lib/mem.c | 4 ++++
>> > > > > 1 file changed, 4 insertions(+)
>
>> > > > > diff --git a/testcases/kernel/mem/lib/mem.c
>> > > > b/testcases/kernel/mem/lib/mem.c
>> > > > > index fbfeef026..ef274a3ac 100644
>> > > > > --- a/testcases/kernel/mem/lib/mem.c
>> > > > > +++ b/testcases/kernel/mem/lib/mem.c
>> > > > > @@ -454,6 +454,9 @@ void create_same_memory(int size, int num, int
>> > unit)
>> > > > > {'a', size*MB}, {'a', size*MB}, {'d', size*MB}, {'d',
>> > > > size*MB},
>> > > > > };
>
>> > > > > + /* Disable smart scan for correct volatile counts. */
>> > > > > + SAFE_FILE_PRINTF(PATH_KSM "smart_scan", "0");
>> > > > NOTE, this fails on the systems without /sys/kernel/mm/ksm/smart_scan:
>
>> > > > mem.c:458: TBROK: Failed to open FILE '/sys/kernel/mm/ksm/smart_scan'
>> > for
>> > > > writing: EACCES (13)
>
>> > > > NOTE, we normally handle the setup like this in test setup function.
>
>> > > > But new API has .save_restore which is more robust for tasks like
>> > this.
>> > > > It's already used in ksm01.c, you need just to add this line:
>> > > > {"/sys/kernel/mm/ksm/smart_scan", "0", TST_SR_SKIP},
>
>
>> > > I guess we need to set 'TST_SR_SKIP_MISSING | TST_SR_TBROK_RO'
>> > > as the last field. Because TST_SR_SKIP will continue the test without
>> > > writing '0' to the smart_scan file, that's not correct if the file
>> > exists.
>> > > It will
>> > > ignore a kernel bug (smart_scan can't be written) by that config.
>
>> > > Per the Doc Petr pointed below:
>> > > TST_SR_SKIP_MISSING – Continue without saving the file if it does not
>> > > exist
>> > > TST_SR_TBROK_RO – End test with TBROK if the file is read-only
>> > > TST_SR_SKIP_RO – Continue without saving the file if it is read-only
>> > > TST_SR_SKIP – Equivalent to 'TST_SR_SKIP_MISSING | TST_SR_SKIP_RO'
>
>
>
>> > > > (instead of both SAFE_FILE_PRINTF)
>
>> > > > See:
>
>
>> > https://github.com/linux-test-project/ltp/wiki/C-Test-API#127-saving--restoring-procsys-values
>
>> > > > I wonder if ksm01.c is the only ksm test which needs to disable this.
>
>
>> > > I think all of the ksm0*.c tests should disable it by the config. The
>> > > smart_scan
>> > > will impact all the tests with invoke key function create_same_memory().
>
>> > ksm05.c and ksm06.c does not use create_same_memory(). Or did I overlook
>> > something?
>
>
>> Good catch, I looked into these tests, seems only ksm05 is debatable
>> for disabling smart_scan, as a simple regression, it suggests disabling
>> ksm daemon to avoid disturb according to some workload.
>> https://github.com/linux-test-project/ltp/blob/master/testcases/kernel/mem/ksm/ksm05.c#L30
>
>> ksm06 is definitely need disable smart_scan, it tests KSM in different
>> 'run' state for merge_accros_nodes.
>
> Thanks for having a look.
>
>> To be on the safe side, I would suggest applying the patch to all ksm*
>> tests,
>> and write a new single for smart_scan if needed.
>
> Agree. I vote for new single for smart_scan related test.
>
I'll add a new test.
> Kind regards,
> Petr
next prev parent reply other threads:[~2023-12-01 20:12 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-27 17:45 [LTP] [PATCH v1] mem: disable KSM smart scan for ksm tests Stefan Roesch
2023-11-27 17:45 ` Stefan Roesch
2023-11-28 7:46 ` [LTP] " Petr Vorel
2023-11-28 7:46 ` Petr Vorel
2023-11-28 10:35 ` Li Wang
2023-11-28 10:35 ` Li Wang
2023-11-28 16:51 ` Petr Vorel
2023-11-28 16:51 ` Petr Vorel
2023-11-29 3:51 ` Li Wang
2023-11-29 3:51 ` Li Wang
2023-11-29 10:10 ` Petr Vorel
2023-11-29 10:10 ` Petr Vorel
2023-12-01 20:11 ` Stefan Roesch [this message]
2023-12-01 20:11 ` Stefan Roesch
2023-12-01 20:06 ` Stefan Roesch
2023-12-01 20:06 ` Stefan Roesch
2023-12-01 20:02 ` Stefan Roesch
2023-12-01 20:02 ` Stefan Roesch
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=87zfyt4r8t.fsf@devkernel.io \
--to=shr@devkernel.io \
--cc=david@redhat.com \
--cc=kernel-team@fb.com \
--cc=linux-mm@kvack.org \
--cc=ltp@lists.linux.it \
--cc=oliver.sang@intel.com \
--cc=pvorel@suse.cz \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.