kselftests: cgroup: update kmem test precision tolerance

Message ID Y4m8Unt6FhWKC6IH@dhcp22.suse.cz
State New
Headers
Series kselftests: cgroup: update kmem test precision tolerance |

Commit Message

Michal Hocko Dec. 2, 2022, 8:50 a.m. UTC
  OK, so this is a full patch to fix this
--- 
From 7f338ed952ba4a100822004bc8399bf720b42899 Mon Sep 17 00:00:00 2001
From: Michal Hocko <mhocko@suse.com>
Date: Fri, 2 Dec 2022 09:45:29 +0100
Subject: [PATCH] kselftests: cgroup: update kmem test precision tolerance

1813e51eece0 ("memcg: increase MEMCG_CHARGE_BATCH to 64") has changed
the batch size while this test case has been left behind. This has led
to a test failure reported by test bot:
not ok 2 selftests: cgroup: test_kmem # exit=1

Update the tolerance for the pcp charges to reflect the
MEMCG_CHARGE_BATCH change to fix this.

Reported-by: kernel test robot <yujie.liu@intel.com>
Link: https://lore.kernel.org/oe-lkp/202212010958.c1053bd3-yujie.liu@intel.com
Signed-off-by: Michal Hocko <mhocko@suse.com>
---
 tools/testing/selftests/cgroup/test_kmem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Shakeel Butt Dec. 2, 2022, 4:54 p.m. UTC | #1
On Fri, Dec 02, 2022 at 09:50:26AM +0100, Michal Hocko wrote:
> OK, so this is a full patch to fix this
> --- 
> From 7f338ed952ba4a100822004bc8399bf720b42899 Mon Sep 17 00:00:00 2001
> From: Michal Hocko <mhocko@suse.com>
> Date: Fri, 2 Dec 2022 09:45:29 +0100
> Subject: [PATCH] kselftests: cgroup: update kmem test precision tolerance
> 
> 1813e51eece0 ("memcg: increase MEMCG_CHARGE_BATCH to 64") has changed
> the batch size while this test case has been left behind. This has led
> to a test failure reported by test bot:
> not ok 2 selftests: cgroup: test_kmem # exit=1
> 
> Update the tolerance for the pcp charges to reflect the
> MEMCG_CHARGE_BATCH change to fix this.
> 
> Reported-by: kernel test robot <yujie.liu@intel.com>
> Link: https://lore.kernel.org/oe-lkp/202212010958.c1053bd3-yujie.liu@intel.com
> Signed-off-by: Michal Hocko <mhocko@suse.com>

Acked-by: Shakeel Butt <shakeelb@google.com>
  
Roman Gushchin Dec. 2, 2022, 5:16 p.m. UTC | #2
On Fri, Dec 02, 2022 at 09:50:26AM +0100, Michal Hocko wrote:
> OK, so this is a full patch to fix this
> --- 
> From 7f338ed952ba4a100822004bc8399bf720b42899 Mon Sep 17 00:00:00 2001
> From: Michal Hocko <mhocko@suse.com>
> Date: Fri, 2 Dec 2022 09:45:29 +0100
> Subject: [PATCH] kselftests: cgroup: update kmem test precision tolerance
> 
> 1813e51eece0 ("memcg: increase MEMCG_CHARGE_BATCH to 64") has changed
> the batch size while this test case has been left behind. This has led
> to a test failure reported by test bot:
> not ok 2 selftests: cgroup: test_kmem # exit=1
> 
> Update the tolerance for the pcp charges to reflect the
> MEMCG_CHARGE_BATCH change to fix this.
> 
> Reported-by: kernel test robot <yujie.liu@intel.com>
> Link: https://lore.kernel.org/oe-lkp/202212010958.c1053bd3-yujie.liu@intel.com
> Signed-off-by: Michal Hocko <mhocko@suse.com>
> ---
>  tools/testing/selftests/cgroup/test_kmem.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/testing/selftests/cgroup/test_kmem.c b/tools/testing/selftests/cgroup/test_kmem.c
> index 22b31ebb3513..1d073e28254b 100644
> --- a/tools/testing/selftests/cgroup/test_kmem.c
> +++ b/tools/testing/selftests/cgroup/test_kmem.c
> @@ -24,7 +24,7 @@
>   * the maximum discrepancy between charge and vmstat entries is number
>   * of cpus multiplied by 32 pages.
>   */
> -#define MAX_VMSTAT_ERROR (4096 * 32 * get_nprocs())
> +#define MAX_VMSTAT_ERROR (4096 * 64 * get_nprocs())

Hi Michal!

You need to update comments above too (it says 32 pages in a couple of places).
I actually sent the similar patch to Andrew yesterday, but hit reply and missed
adding people to cc.

Please, feel free to send your v2 with comments fixed and my acked-by,
or we can go with my version.

Thanks!

--

From 354850a59bb8e000490a23bc768f4d3183faf8e4 Mon Sep 17 00:00:00 2001
From: Roman Gushchin <roman.gushchin@linux.dev>
Date: Thu, 1 Dec 2022 18:05:07 -0800
Subject: [PATCH] kselftests/cgroup: adjust memcg charge batch size

Commit 1813e51eece0 ("memcg: increase MEMCG_CHARGE_BATCH to 64")
doubled the memcg charge batch size, which broke the kmem_memcg_deletion
test. Bump the corresponding error margin on the test side to fix the
problem.

Reported-by: kernel test robot <yujie.liu@intel.com>
Link: https://lore.kernel.org/oe-lkp/202212010958.c1053bd3-yujie.liu@intel.com
Fixes: 1813e51eece0 ("memcg: increase MEMCG_CHARGE_BATCH to 64")
Signed-off-by: Roman Gushchin <roman.gushchin@linux.dev>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Shakeel Butt <shakeelb@google.com>
---
 tools/testing/selftests/cgroup/test_kmem.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/testing/selftests/cgroup/test_kmem.c b/tools/testing/selftests/cgroup/test_kmem.c
index 22b31ebb3513..258ddc565deb 100644
--- a/tools/testing/selftests/cgroup/test_kmem.c
+++ b/tools/testing/selftests/cgroup/test_kmem.c
@@ -19,12 +19,12 @@


 /*
- * Memory cgroup charging is performed using percpu batches 32 pages
+ * Memory cgroup charging is performed using percpu batches 64 pages
  * big (look at MEMCG_CHARGE_BATCH), whereas memory.stat is exact. So
  * the maximum discrepancy between charge and vmstat entries is number
- * of cpus multiplied by 32 pages.
+ * of cpus multiplied by 64 pages.
  */
-#define MAX_VMSTAT_ERROR (4096 * 32 * get_nprocs())
+#define MAX_VMSTAT_ERROR (4096 * 64 * get_nprocs())


 static int alloc_dcache(const char *cgroup, void *arg)
--
2.38.1
  
Liu, Yujie Dec. 2, 2022, 5:48 p.m. UTC | #3
On Fri, Dec 02, 2022 at 09:50:26AM +0100, Michal Hocko wrote:
> OK, so this is a full patch to fix this
> --- 
> From 7f338ed952ba4a100822004bc8399bf720b42899 Mon Sep 17 00:00:00 2001
> From: Michal Hocko <mhocko@suse.com>
> Date: Fri, 2 Dec 2022 09:45:29 +0100
> Subject: [PATCH] kselftests: cgroup: update kmem test precision tolerance
> 
> 1813e51eece0 ("memcg: increase MEMCG_CHARGE_BATCH to 64") has changed
> the batch size while this test case has been left behind. This has led
> to a test failure reported by test bot:
> not ok 2 selftests: cgroup: test_kmem # exit=1
> 
> Update the tolerance for the pcp charges to reflect the
> MEMCG_CHARGE_BATCH change to fix this.
> 
> Reported-by: kernel test robot <yujie.liu@intel.com>
> Link: https://lore.kernel.org/oe-lkp/202212010958.c1053bd3-yujie.liu@intel.com
> Signed-off-by: Michal Hocko <mhocko@suse.com>

The failure is gone after applying this patch. Thanks.

Tested-by: Yujie Liu <yujie.liu@intel.com>

=========================================================================================
compiler/group/kconfig/rootfs/tbox_group/testcase:
  gcc-11/cgroup/x86_64-rhel-8.3-kselftests/debian-12-x86_64-20220629.cgz/lkp-icl-2sp5/kernel-selftests

commit:
  1813e51eece0a ("memcg: increase MEMCG_CHARGE_BATCH to 64")
  8046f9500f4b7 ("kselftests: cgroup: update kmem test precision tolerance")

  1813e51eece0a                8046f9500f4b7
---------------- ------------- -------------
       fail:runs  %reproduction    fail:runs
           |             |             |
          3:3         -100%            :5     kernel-selftests.cgroup.test_kmem.test_kmem_memcg_deletion.fail

> ---
>  tools/testing/selftests/cgroup/test_kmem.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/testing/selftests/cgroup/test_kmem.c b/tools/testing/selftests/cgroup/test_kmem.c
> index 22b31ebb3513..1d073e28254b 100644
> --- a/tools/testing/selftests/cgroup/test_kmem.c
> +++ b/tools/testing/selftests/cgroup/test_kmem.c
> @@ -24,7 +24,7 @@
>   * the maximum discrepancy between charge and vmstat entries is number
>   * of cpus multiplied by 32 pages.
>   */
> -#define MAX_VMSTAT_ERROR (4096 * 32 * get_nprocs())
> +#define MAX_VMSTAT_ERROR (4096 * 64 * get_nprocs())
>  
>  
>  static int alloc_dcache(const char *cgroup, void *arg)
> -- 
> 2.30.2
> 
> -- 
> Michal Hocko
> SUSE Labs
  
Michal Hocko Dec. 5, 2022, 7:33 a.m. UTC | #4
On Fri 02-12-22 09:16:17, Roman Gushchin wrote:
> On Fri, Dec 02, 2022 at 09:50:26AM +0100, Michal Hocko wrote:
> > OK, so this is a full patch to fix this
> > --- 
> > From 7f338ed952ba4a100822004bc8399bf720b42899 Mon Sep 17 00:00:00 2001
> > From: Michal Hocko <mhocko@suse.com>
> > Date: Fri, 2 Dec 2022 09:45:29 +0100
> > Subject: [PATCH] kselftests: cgroup: update kmem test precision tolerance
> > 
> > 1813e51eece0 ("memcg: increase MEMCG_CHARGE_BATCH to 64") has changed
> > the batch size while this test case has been left behind. This has led
> > to a test failure reported by test bot:
> > not ok 2 selftests: cgroup: test_kmem # exit=1
> > 
> > Update the tolerance for the pcp charges to reflect the
> > MEMCG_CHARGE_BATCH change to fix this.
> > 
> > Reported-by: kernel test robot <yujie.liu@intel.com>
> > Link: https://lore.kernel.org/oe-lkp/202212010958.c1053bd3-yujie.liu@intel.com
> > Signed-off-by: Michal Hocko <mhocko@suse.com>
> > ---
> >  tools/testing/selftests/cgroup/test_kmem.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/tools/testing/selftests/cgroup/test_kmem.c b/tools/testing/selftests/cgroup/test_kmem.c
> > index 22b31ebb3513..1d073e28254b 100644
> > --- a/tools/testing/selftests/cgroup/test_kmem.c
> > +++ b/tools/testing/selftests/cgroup/test_kmem.c
> > @@ -24,7 +24,7 @@
> >   * the maximum discrepancy between charge and vmstat entries is number
> >   * of cpus multiplied by 32 pages.
> >   */
> > -#define MAX_VMSTAT_ERROR (4096 * 32 * get_nprocs())
> > +#define MAX_VMSTAT_ERROR (4096 * 64 * get_nprocs())
> 
> Hi Michal!
> 
> You need to update comments above too (it says 32 pages in a couple of places).
> I actually sent the similar patch to Andrew yesterday, but hit reply and missed
> adding people to cc.
> 
> Please, feel free to send your v2 with comments fixed and my acked-by,
> or we can go with my version.

It seems Andrew has already done all the fixups. Thanks both to you and
Andrew!
  

Patch

diff --git a/tools/testing/selftests/cgroup/test_kmem.c b/tools/testing/selftests/cgroup/test_kmem.c
index 22b31ebb3513..1d073e28254b 100644
--- a/tools/testing/selftests/cgroup/test_kmem.c
+++ b/tools/testing/selftests/cgroup/test_kmem.c
@@ -24,7 +24,7 @@ 
  * the maximum discrepancy between charge and vmstat entries is number
  * of cpus multiplied by 32 pages.
  */
-#define MAX_VMSTAT_ERROR (4096 * 32 * get_nprocs())
+#define MAX_VMSTAT_ERROR (4096 * 64 * get_nprocs())
 
 
 static int alloc_dcache(const char *cgroup, void *arg)