From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0562FC4167B for ; Wed, 29 Nov 2023 03:52:08 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 93FBC6B03A7; Tue, 28 Nov 2023 22:52:07 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 8F0396B03A8; Tue, 28 Nov 2023 22:52:07 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7B7526B03A9; Tue, 28 Nov 2023 22:52:07 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 6B7556B03A7 for ; Tue, 28 Nov 2023 22:52:07 -0500 (EST) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 42C91C03C0 for ; Wed, 29 Nov 2023 03:52:07 +0000 (UTC) X-FDA: 81509618694.16.E2F4D63 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf29.hostedemail.com (Postfix) with ESMTP id 236E9120008 for ; Wed, 29 Nov 2023 03:52:04 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=J0JTIfla; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf29.hostedemail.com: domain of liwan@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=liwan@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1701229925; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=rFGzEhHVY9flTXDIB2zslg/z1sDObGeeCLFJHltS45g=; b=zRiewrRfyrwfmS0Yr53OA8szgkixRWIdp/4or5mebnRniW1A5dfqoL6fVGav5KO0/yct/D ATqtBOb1cYZiNOCRxaj7fNnUhBZ+Tkynkmw76qvJLzgi92yKBEry16q8i5jqIKqvTqvGxO ZZWEDmUEOAftTueunbehRMGFvg0KiQI= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=J0JTIfla; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf29.hostedemail.com: domain of liwan@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=liwan@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1701229925; a=rsa-sha256; cv=none; b=WplkMVdsHhJ/dlTUDIHPTlekLTEgogjo2NNsTpsrnAnNqInfLmVmw/Aodu6HJeVqMVMTcw hT+JMCllN0WsJi99CpHTCGXGj7wPl3uoSLJpMwWwcqnwpHjhT4rV9w/PJuZsj5EDxaqQde qyGS3Jw6YZqcZRvZAl0WJUOB6pNE7PM= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1701229924; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=rFGzEhHVY9flTXDIB2zslg/z1sDObGeeCLFJHltS45g=; b=J0JTIflaVQ+gTiZ9kA/wBKM9HoV/CglBv2AQIgKodxURfJx4IH1V+s6lMQbA+HLoq8rwxI bVrmXKP6zYzkAl7bITHVqaAWIJfiU2M0oOI6f3dr3/4s9qz+jLxrn96z0FWjfjRiSY7QFE R1oVN2JkSBJbEXLEaAK3Y34xY7zo0K8= Received: from mail-lf1-f71.google.com (mail-lf1-f71.google.com [209.85.167.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-265-lltysRBHNjWc035cl7Yv-A-1; Tue, 28 Nov 2023 22:52:02 -0500 X-MC-Unique: lltysRBHNjWc035cl7Yv-A-1 Received: by mail-lf1-f71.google.com with SMTP id 2adb3069b0e04-50ab368b334so302606e87.0 for ; Tue, 28 Nov 2023 19:52:02 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701229921; x=1701834721; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=rFGzEhHVY9flTXDIB2zslg/z1sDObGeeCLFJHltS45g=; b=fbaKZocygtNAz0HttJmUMbLduYH3k+Yn2AmttGvcwgLrI99wv6d7FNPXrbQTurS6dV X8fBaaJ8VCqq0rkplBrz9VJFf0xkXJjhOnI/jMxmk1Rwl6ZB42KEvuJk7d4oxdsr//fu cCGdaNX8PDCh94dvazQogBLE753qBUkkU00aI/uVaoSg55wGZGmpY4m5nGdG8Q8Hpd33 03YHZf56VEXjUb7+OjoL4mWhUo7PHQ3+ociF1dHjhCF7BBTCE4uABHm4PTmBSX92hUC+ iSPLZDNcPvlgelzn/d5gtNNnh7TbvrK0UArZvOiIVE2YHHYQHSABy3xNZQbW472NOVjr q+7Q== X-Gm-Message-State: AOJu0Yy6UAPqx1wCBlsAs+gMucFGekLj/Giy7NK/YOhgnkjaGN841GIU 31zS6HLJdMPZTpJn10gqy6WXcp6iKbYtEO8ErtzZvP2QwWRES7vUyIh+3IeYeCN8ji4XiZ4FgKa LqYofBYJ5mlLz3aF6EAUrnQbQ+MU= X-Received: by 2002:a05:6512:3b86:b0:50a:ae89:491f with SMTP id g6-20020a0565123b8600b0050aae89491fmr7879668lfv.3.1701229921016; Tue, 28 Nov 2023 19:52:01 -0800 (PST) X-Google-Smtp-Source: AGHT+IFhiQ0mcBwBgzA7wHAY/vJ8su/RQsr2JmQyjOti1tQfKeWVscXkivUWk/3JBfQ7uHAPtRhmPfsGfHH80qOE6Gk= X-Received: by 2002:a05:6512:3b86:b0:50a:ae89:491f with SMTP id g6-20020a0565123b8600b0050aae89491fmr7879656lfv.3.1701229920589; Tue, 28 Nov 2023 19:52:00 -0800 (PST) MIME-Version: 1.0 References: <20231127174517.2369593-1-shr@devkernel.io> <20231128074626.GA298624@pevik> <20231128165132.GA406520@pevik> In-Reply-To: <20231128165132.GA406520@pevik> From: Li Wang Date: Wed, 29 Nov 2023 11:51:48 +0800 Message-ID: Subject: Re: [LTP] [PATCH v1] mem: disable KSM smart scan for ksm tests To: Petr Vorel Cc: Stefan Roesch , kernel-team@fb.com, linux-mm@kvack.org, david@redhat.com, oliver.sang@intel.com, ltp@lists.linux.it X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: multipart/alternative; boundary="000000000000193020060b4275dc" X-Rspamd-Queue-Id: 236E9120008 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: tpwr4gmeyxs66yozckgu4t6rmw5iro8w X-HE-Tag: 1701229924-497833 X-HE-Meta: U2FsdGVkX1+tNquRUI61C9A5YbJFGyjzrIgU1ai+tPMFAEUHXGzynGWLW3gpAqjENolzAdKblyhAPGv9dftCcJc7qFqGquKKYvsdG0hM/fMv6XJutUxK7jPFqonVGygUizBKc2mjcGdJ15HmIPVsjYhVtsr2jCh3dop8EIoQt+xjgvceRH/jq6xxg34nBVKF/mBGUf7oF84P8wDirQfqgl4dLLe8XWPoqgBFWHq22gg8BQf/gkiNK4khYfHZYH3Y4erPuj1V9A+Ol65yRILjOjuEfKyCHvIAuSkJhxs4R0XHQhocMykYuLwdv4FFDj1KCiKoH8CeYPkbQLxN9OY345oK17zXkLX2bhEyVEkdA6cLZuYG/KrnkP2YIyhdHkrb+z/vq9OyuTauWhyzzKdQf9tom37I+GrvtBSw7zZnTovvVkJd6VcaA9oqc7hj4If+keuwwzy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fbwknPYw7mkvJO+GAIMAZuOjEfslF+WqwjpHmYwIqGYaJz7sZ3N63DMXbFhiVg64H7e359ESBkrOUk4nQSR1BDOg4pSw4T7FCDsvpeDNEYyyMkx X-Bogosity: Ham, tests=bogofilter, spamicity=0.000001, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: --000000000000193020060b4275dc Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, Nov 29, 2023 at 12:51=E2=80=AFAM Petr Vorel wrote: > Hi Stefan, Li, > > > Hi Stefan, Petr, > > > On Tue, Nov 28, 2023 at 3:46=E2=80=AFPM Petr Vorel wro= te: > > > > Hi Stefan, > > > > > This disables the "smart scan" KSM feature to make sure that the > volatile > > > > count remains at 0. > > > > > Signed-off-by: Stefan Roesch > > > nit: you forgot 'shr@' > > > Signed-off-by: Stefan Roesch > > > > > Reported-by: kernel test robot > > > > Closes: > > > > https://lore.kernel.org/oe-lkp/202311161132.13d8ce5a-oliver.sang@intel.co= m > > > > --- > > > > 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 =E2=80=93 Continue without saving the file if it = does not > > exist > > TST_SR_TBROK_RO =E2=80=93 End test with TBROK if the file is read-onl= y > > TST_SR_SKIP_RO =E2=80=93 Continue without saving the file if it is re= ad-only > > TST_SR_SKIP =E2=80=93 Equivalent to 'TST_SR_SKIP_MISSING | TST_SR_SKI= P_RO' > > > > > > (instead of both SAFE_FILE_PRINTF) > > > > See: > > > > > https://github.com/linux-test-project/ltp/wiki/C-Test-API#127-saving--res= toring-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. 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. --=20 Regards, Li Wang --000000000000193020060b4275dc Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


On Wed, Nov 29, 2023 at 12:51=E2=80=AFAM Petr Vorel= <pvorel@suse.cz> wrote:
Hi Stefan, Li,

> Hi Stefan, Petr,

> On Tue, Nov 28, 2023 at 3:46=E2=80=AFPM 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.ker= nel.org/oe-lkp/202311161132.13d8ce5a-oliver.sang@intel.com
> > > ---
> > >=C2=A0 testcases/kernel/mem/lib/mem.c | 4 ++++
> > >=C2=A0 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 nu= m, int unit)
> > >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 {'a'= , size*MB}, {'a', size*MB}, {'d', size*MB}, {'d', > > size*MB},
> > >=C2=A0 =C2=A0 =C2=A0 =C2=A0};

> > > +=C2=A0 /* Disable smart scan for correct volatile counts. *= /
> > > +=C2=A0 SAFE_FILE_PRINTF(PATH_KSM "smart_scan", &q= uot;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/sma= rt_scan' for
> > writing: EACCES (13)

> > NOTE, we normally handle the setup like this in test setup functi= on.

> > But new API has .save_restore which is more robust for tasks=C2= =A0 like this.
> > It's already used in ksm01.c, you need just to add this line:=
> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0{"/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<= br> > 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.<= br>
> Per the Doc Petr pointed below:
>=C2=A0 =C2=A0TST_SR_SKIP_MISSING =E2=80=93 Continue without saving the = file if it does not
> exist
>=C2=A0 =C2=A0TST_SR_TBROK_RO =E2=80=93 End test with TBROK if the file = is read-only
>=C2=A0 =C2=A0TST_SR_SKIP_RO =E2=80=93 Continue without saving the file = if it is read-only
>=C2=A0 =C2=A0TST_SR_SKIP =E2=80=93 Equivalent to 'TST_SR_SKIP_MISSI= NG | TST_SR_SKIP_RO'



> > (instead of both SAFE_FILE_PRINTF)

> > See:

> > https://github.com/linux-test-project/ltp/wiki/C-Test-API#127-saving--r= estoring-procsys-values

> > I wonder if ksm01.c is the only ksm test which needs to disable t= his.


> I think all of the ksm0*.c tests should disable it by the config. The<= br> > 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=C2=A0these tests, seem= s only ksm05 is debatable
for disabling smart_scan, as a simple regression, it suggest= s disabling
ksm= daemon to avoid disturb=C2=A0according to some workload.

ksm= 06 is definitely need disable=C2=A0smart_scan, it tests KSM in different
'run' sta= te for merge_accros_nodes.

To be on the safe side, I would suggest applying the patch to all ksm* te= sts,
and write = a new single for smart_scan if needed.


--
Regards,
Li Wang
--000000000000193020060b4275dc--