Messages in this thread | | | Date | Wed, 6 Jan 2010 02:35:53 -0800 (PST) | From | David Rientjes <> | Subject | RE: [PATCH] nodemask.h: change any_online_node() to a static inline |
| |
On Tue, 5 Jan 2010, H Hartley Sweeten wrote:
> > Could you simply remove any_online_node() and replace its callers with > > first_node(node_online_map) instead? > > No idea ;-) > > My main intention with this patch was to quite some sparse noise in > net/sunrpc/svc.c. This seemed the cleanest way to do it. >
It certainly silents the warning, which is good, but it also leaves behind a macro that can simply be removed and reimplemented with first_node(node_online_map) given the current use cases.
> It looks like any_online_node is, currently, only called by: > > arch/powerpc/mm/numa.c > 3 places, twice setting a local int variable called 'nid' and once just > returning the 'node' from the macro. All three call the marco as: > > ... any_online_node(NODE_MASK_ALL); >
NODE_MASK_ALL is a nodemask_t with all bits set, so this will simply return the first nid where node_online(nid) is true. That's equivalent to first_node(node_online_map).
> net/sunrpc/svc.c > 1 place, setting a local unsigned int variable called 'node'. Calls the > macro as: > > ... any_online_node(node_online_map); >
Same thing, except this doesn't require any iteration since node_online() for the first bit in node_online_map will always be true.
> I really don't know if the macro could be replaced by first_node(node_online_map). >
It can, so I think an even better step would be to remove any_online_node() completely and convert the callers you've identified to use the new implementation.
Thanks!
| |