Re: [LTP] [PATCH v7 1/2] cpuset02: Convert the test6 from cpuset_memory_testset.sh to C code

Wei Gao via ltp
2025-03-26T04:15:09Z

On Tue, Mar 25, 2025 at 03:00:18PM +0100, Petr Vorel wrote:
> Hi Wei,
>
> ...
> > +static void run_test(void)
> > +{
> > + int pid;
> > + char node_id_str[256];
> > +
> > + cg_cpuset_0 = tst_cg_group_mk(tst_cg, "0");
> > +
> > + sprintf(node_id_str, "%u", check_node_id);
> > + SAFE_CG_PRINT(cg_cpuset_0, "cpuset.mems", node_id_str);
> > + SAFE_FILE_PRINTF("/proc/sys/vm/nr_hugepages", "%d", 1);
>
> You changed the /proc/sys/vm/nr_hugepages to 1, because Cyril objected the code
> in v6:
>
> SAFE_FILE_PRINTF("/proc/sys/vm/nr_hugepages", "%d", 2 * node->cnt);
>
> But as I note there [1], the original shell test did it this way and kernel docs
> allows more than 1 to allocate. I'm obviously missing something.
>
> [1] https://lore.kernel.org/ltp/20250325133611.GB372417@pevik/
>
My understanding from Cyril's comments is no need reserve more hugepages, since
this test case ONLY allocate 1 page through mmap.
@Cyril could you help confirm this?

>
> Kind regards,
> Petr