>Hello Xiaokai. > >On Tue, Apr 14, 2026 at 11:05:23AM +0000, [email protected] 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())
Thanks for the review, yes, this will improve the test' portability across architectures with different page sizes. >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. Agreed. Including memcontrol.h ensures the test stays in sync with kernel changes. >Thanks, >Michal

