[PATCH 1/2] include/linux/nodemask.h: create node_available() helper

Bjorn Helgaas helgaas at kernel.org
Fri May 6 10:23:48 PDT 2022


Subject line convention looks like "numa: ..."

On Fri, May 06, 2022 at 01:58:00AM +0000, Peng Liu wrote:
> Lots of code dose
               does

> 	node != NUMA_NO_NODE && !node_online(node)
> or
> 	node == NUMA_NO_NODE || node_online(node)
> so create node_available to do this to simplify code.
            node_available()

I'm not really sure what meaning "node_available" conveys, though.
Probably just because I don't understand NUMA.

Should the test for NUMA_NO_NODE be folded into node_state() or
node_online() directly instead of adding a new node_available()
interface?

NUMA_NO_NODE is -1.  It's not clear to me that node_state()/
node_isset()/test_bit() would do the right thing given -1.  I doubt
all node_online() callers ensure they don't pass NUMA_NO_NODE.

> --- a/include/linux/nodemask.h
> +++ b/include/linux/nodemask.h
> @@ -70,6 +70,7 @@
>   *
>   * int node_online(node)		Is some node online?
>   * int node_possible(node)		Is some node possible?
> + * int node_available(node)		Is some node available(online or NUMA_NO_NODE)?

Existing file generally fits in 80 columns; follow that lead unless
you have a really good reason.  E.g., maybe this?

  + * int node_available(node)		Node online or NUMA_NO_NODE



More information about the linux-arm-kernel mailing list