Re: [PATCH] set_pgdat_percpu_threshold() don't usefor_each_online_cpu

From: Christoph Lameter
Date: Fri Nov 19 2010 - 10:29:34 EST


On Tue, 16 Nov 2010, Andrew Morton wrote:

> > Following patch use (2) beucase removing get_online_cpus() makes good
> > side effect. It reduce potentially cpu-hotplug vs memory-shortage deadlock
> > risk.
>
> Well. Being able to run for_each_online_cpu() is a pretty low-level
> and fundamental thing. It's something we're likely to want to do more
> and more of as time passes. It seems a bad thing to tell ourselves
> that we cannot use it in reclaim context. That blots out large chunks
> of filesystem and IO-layer code as well!

The online map can change if no locks were taken. Thus it
becomes something difficult to do in some code paths and overhead
increases significantly.

> > threshold = (*calculate_pressure)(zone);
> > - for_each_online_cpu(cpu)
> > + for_each_possible_cpu(cpu)
> > per_cpu_ptr(zone->pageset, cpu)->stat_threshold
> > = threshold;
> > }
> > - put_online_cpus();
> > }
>
> That's a pretty sad change IMO, especially of num_possible_cpus is much
> larger than num_online_cpus.

num_possible_cpus should only be higher if the arch code has detected
that the system has the ability to physically online and offline cpus.
I have never actually seen such a system. Heard rumors from Fujitsu that
they have something.

Maybe the virtualization people also need this? Otherwise cpu
online/offline is useful mainly to debug the cpu offline/online handling
in various subsystems which is unsurprisingly often buggy given the rarity
of encountering such hardware.

> What do we need to do to make get_online_cpus() safe to use in reclaim
> context? (And in kswapd context, if that's really equivalent to
> "reclaim context").

I think its not worth the effort.

--
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/