lkml.org 
[lkml]   [2010]   [Nov]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] set_pgdat_percpu_threshold() don't use for_each_online_cpu
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.



\
 
 \ /
  Last update: 2010-11-19 16:31    [W:0.068 / U:16.364 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site