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

Petr Vorel
2025-02-27T16:03:26Z

Hi Wei,

...
> lib/tst_cgroup.c | 1 +
> runtest/mm | 1 +
> testcases/kernel/mem/.gitignore | 1 +
> testcases/kernel/mem/cpuset/Makefile | 6 +
> testcases/kernel/mem/cpuset/cpuset02.c | 142 ++++++++++++++++++
> .../mq_timedreceive/mq_timedreceive01.c | 80 +++++++---
This is completely unrelated change. Please remove it in the next version.

...
> +++ b/testcases/kernel/mem/cpuset/Makefile
> @@ -19,6 +19,12 @@

> top_srcdir ?= ../../../..

> +LTPLIBS = numa
> +
> include $(top_srcdir)/include/mk/testcases.mk
> include $(top_srcdir)/testcases/kernel/mem/include/libmem.mk
> +
> +LDLIBS += $(NUMA_LIBS)
IMHO we don't need LDLIBS += $(NUMA_LIBS) ? It compiles without it
because it's added by /testcases/kernel/include/lib.mk due Cyril's change:
6f830ea5c0 ("lib: Replace path_exist() with tst_path_exists()")

> +LTPLDLIBS = -lltpnuma
This change is related to cpuset02, it should be prefixed with cpuset02:

..
> +++ b/testcases/kernel/mem/cpuset/cpuset02.c
> @@ -0,0 +1,142 @@
> +// SPDX-License-Identifier: LGPL-2.1-or-later
> +/*
> + * Copyright (c) 2009 FUJITSU LIMITED Miao Xie <miaox@cn.fujitsu.com>
> + * Copyright (c) 2023 SUSE LLC <wegao@suse.com>
> + */
> +
> +/*\
> + * [Description]

Also please delete [Description] in next version.
> + *
> + * Test checks cpuset.mems works with hugepage file.
> + */
> +
> +#define _GNU_SOURCE
> +#include <stdio.h>
> +#include <sys/mount.h>
> +#include <limits.h>
> +#include <sys/param.h>
> +#include <sys/types.h>
> +#include "tst_test.h"
> +
> +#ifdef HAVE_NUMA_V2
> +#include <numa.h>
> +#include <numaif.h>
> +#include <errno.h>
> +#include "tst_numa.h"
> +#include "tst_safe_stdio.h"
> +#include "mem.h"

And, please, rebase. Recent Cyril's cleanup removed "mem.h", see:
decd09c5dab6ad1694857116c011e01f8cc65788~..ac1af455d3384f1bbbda994aee42aeb036c27a23

> +#include "numa_helper.h"
> +
> +#define MNTPOINT "hugetlbfs/"
> +#define HUGE_PAGE_FILE MNTPOINT "hugepagefile"
> +#define PAGES_ALLOCATED 16u

Kind regards,
Petr