linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Michal Koutný" <mkoutny@suse.com>
To: ranxiaokai627@163.com
Cc: hannes@cmpxchg.org, mhocko@kernel.org, roman.gushchin@linux.dev,
	 shakeel.butt@linux.dev, muchun.song@linux.dev, tj@kernel.org,
	shuah@kernel.org,  kuba@kernel.org, hughd@google.com,
	akpm@linux-foundation.org,  cgroups@vger.kernel.org,
	linux-mm@kvack.org, linux-kselftest@vger.kernel.org,
	 linux-kernel@vger.kernel.org, ran.xiaokai@zte.com.cn
Subject: Re: [PATCH 1/2] kselftests: cgroup: update kmem test tolerance for multi-memcg stock
Date: Wed, 15 Apr 2026 11:53:13 +0200	[thread overview]
Message-ID: <vjhou23d62pvtdqsan2nrlldkwf27qchpfmzf4yoetqn2gdhbj@cfiuqzzotbxf> (raw)
In-Reply-To: <20260414110524.2414-2-ranxiaokai627@163.com>

[-- Attachment #1: Type: text/plain, Size: 947 bytes --]

Hello Xiaokai.

On Tue, Apr 14, 2026 at 11:05:23AM +0000, ranxiaokai627@163.com wrote:
> Fixes: f735eebe55f8 ("memcg: multi-memcg percpu charge cache")

An interesting catch.

> -#define MAX_VMSTAT_ERROR (4096 * 64 * get_nprocs())
> +#define NR_MEMCG_STOCK 7
> +#define MAX_VMSTAT_ERROR (4096 * 64 * NR_MEMCG_STOCK * get_nprocs())

When you touch this, I think this could be factored into it too:

+#define MAX_VMSTAT_ERROR (sysconf(_SC_PAGESIZE) * 64 * NR_MEMCG_STOCK * get_nprocs())

And given how much the selftest depends in this implementation
detail(?), I see that there are other selftests that include directly
from the tree, I'd suggest also
#include "../../../../include/linux/memcontrol.h"

and use the constant from there (i.e. move NR_MEMCG_STOCK to there too).

That should make the selftest more flexible, resilient to future changes
and it'd document ramification of these constants too.

Thanks,
Michal

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 265 bytes --]

  reply	other threads:[~2026-04-15  9:53 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-14 11:05 [PATCH 0/2] kselftests: cgroup: fix test_kmem false failures ranxiaokai627
2026-04-14 11:05 ` [PATCH 1/2] kselftests: cgroup: update kmem test tolerance for multi-memcg stock ranxiaokai627
2026-04-15  9:53   ` Michal Koutný [this message]
2026-04-15 11:03     ` ranxiaokai627
2026-04-14 11:05 ` [PATCH 2/2] kselftests: cgroup: account for slab memory in test_percpu_basic ranxiaokai627

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=vjhou23d62pvtdqsan2nrlldkwf27qchpfmzf4yoetqn2gdhbj@cfiuqzzotbxf \
    --to=mkoutny@suse.com \
    --cc=akpm@linux-foundation.org \
    --cc=cgroups@vger.kernel.org \
    --cc=hannes@cmpxchg.org \
    --cc=hughd@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@kernel.org \
    --cc=muchun.song@linux.dev \
    --cc=ran.xiaokai@zte.com.cn \
    --cc=ranxiaokai627@163.com \
    --cc=roman.gushchin@linux.dev \
    --cc=shakeel.butt@linux.dev \
    --cc=shuah@kernel.org \
    --cc=tj@kernel.org \
    /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