Re: [PATCH 1/7] nodemask: numa: reorganize inclusion path

From: Yury Norov
Date: Thu Feb 13 2025 - 10:35:53 EST


On Wed, Feb 12, 2025 at 05:48:08PM +0100, Andrea Righi wrote:
> From: Yury Norov <yury.norov@xxxxxxxxx>
>
> Nodemasks now pull linux/numa.h for MAX_NUMNODES and NUMA_NO_NODE
> macros. This series makes numa.h depending on nodemasks, so we hit
> a circular dependency.
>
> Nodemasks library is highly employed by NUMA code, and it would be
> logical to resolve the circular dependency by making NUMA headers
> dependent nodemask.h.
>
> Signed-off-by: Yury Norov <yury.norov@xxxxxxxxx>

You must sign-off this patch yourself as well, if you pull it with
your series.

> ---
> include/linux/nodemask.h | 1 -
> include/linux/nodemask_types.h | 11 ++++++++++-
> include/linux/numa.h | 10 +---------
> 3 files changed, 11 insertions(+), 11 deletions(-)
>
> diff --git a/include/linux/nodemask.h b/include/linux/nodemask.h
> index 9fd7a0ce9c1a7..27644a6edc6ee 100644
> --- a/include/linux/nodemask.h
> +++ b/include/linux/nodemask.h
> @@ -94,7 +94,6 @@
> #include <linux/bitmap.h>
> #include <linux/minmax.h>
> #include <linux/nodemask_types.h>
> -#include <linux/numa.h>
> #include <linux/random.h>
>
> extern nodemask_t _unused_nodemask_arg_;
> diff --git a/include/linux/nodemask_types.h b/include/linux/nodemask_types.h
> index 6b28d97ea6ed0..f850a48742f1f 100644
> --- a/include/linux/nodemask_types.h
> +++ b/include/linux/nodemask_types.h
> @@ -3,7 +3,16 @@
> #define __LINUX_NODEMASK_TYPES_H
>
> #include <linux/bitops.h>
> -#include <linux/numa.h>
> +
> +#ifdef CONFIG_NODES_SHIFT
> +#define NODES_SHIFT CONFIG_NODES_SHIFT
> +#else
> +#define NODES_SHIFT 0
> +#endif
> +
> +#define MAX_NUMNODES (1 << NODES_SHIFT)
> +
> +#define NUMA_NO_NODE (-1)
>
> typedef struct { DECLARE_BITMAP(bits, MAX_NUMNODES); } nodemask_t;
>
> diff --git a/include/linux/numa.h b/include/linux/numa.h
> index 3567e40329ebc..31d8bf8a951a7 100644
> --- a/include/linux/numa.h
> +++ b/include/linux/numa.h
> @@ -3,16 +3,8 @@
> #define _LINUX_NUMA_H
> #include <linux/init.h>
> #include <linux/types.h>
> +#include <linux/nodemask.h>
>
> -#ifdef CONFIG_NODES_SHIFT
> -#define NODES_SHIFT CONFIG_NODES_SHIFT
> -#else
> -#define NODES_SHIFT 0
> -#endif
> -
> -#define MAX_NUMNODES (1 << NODES_SHIFT)
> -
> -#define NUMA_NO_NODE (-1)
> #define NUMA_NO_MEMBLK (-1)
>
> static inline bool numa_valid_node(int nid)
> --
> 2.48.1