Re: [PATCH v2] cpusets: randomize node rotor used incpuset_mem_spread_node()

From: Michal Hocko
Date: Fri May 27 2011 - 19:17:10 EST


On Fri 27-05-11 14:20:51, Andrew Morton wrote:
> On Fri, 27 May 2011 14:47:05 +0200
> Michal Hocko <mhocko@xxxxxxx> wrote:
>
> > > We use "#if MAX_NUMNODES > 1" in nodemask.h, but we use CONFIG_NUMA
> > > when deciding to build mempolicy.o. That's a bit odd - why didn't
> > > nodemask.h use CONFIG_NUMA?
> >
> > We have this since the kernel git age. I guess this is just for
> > optimizations where some functions can be NOOP when there is only one
> > node.
> >
> > I know that this is ugly but what if we just define node_random in the
> > header?
>
> I think I prefer this:
>
> --- a/include/linux/nodemask.h~cpusets-randomize-node-rotor-used-in-cpuset_mem_spread_node-fix-2
> +++ a/include/linux/nodemask.h
> @@ -433,8 +433,6 @@ static inline void node_set_offline(int
> nr_online_nodes = num_node_state(N_ONLINE);
> }
>
> -extern int node_random(const nodemask_t *maskp);
> -
> #else
>
> static inline int node_state(int node, enum node_states state)
> @@ -466,7 +464,15 @@ static inline int num_node_state(enum no
> #define node_set_online(node) node_set_state((node), N_ONLINE)
> #define node_set_offline(node) node_clear_state((node), N_ONLINE)
>
> -static inline int node_random(const nodemask_t *mask) { return 0; }
> +#endif
> +
> +#if defined(CONFIG_NUMA) && (MAX_NUMNODES > 1)
> +extern int node_random(const nodemask_t *maskp);
> +#else
> +static inline int node_random(const nodemask_t *mask)
> +{
> + return 0;
> +}
> #endif

I have to admit that I quite don't understand concept of several nodes
with UMA archs but do we really want to provide the sane node all the
time?

--
Michal Hocko
SUSE Labs
SUSE LINUX s.r.o.
Lihovarska 1060/12
190 00 Praha 9
Czech Republic
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/