Re: [PATCH] workqueue: update numa affinity when node hotplug

Kamezawa Hiroyuki
2015-03-02T08:52:49Z

On 2015/02/27 20:54, Tejun Heo wrote:
> Hello,
>
> On Fri, Feb 27, 2015 at 06:04:52PM +0800, Gu Zheng wrote:
>> Yasuaki Ishimatsu found that with node online/offline, cpu<->node
>> relationship is established. Because workqueue uses a info which was
>> established at boot time, but it may be changed by node hotpluging.
>
> I've asked this a couple times now but can somebody please justify why
> cpu<->node relationship needs to change? If it has to change, that's
> okay but let's please first make sure that we understand why such
> thing is necessary so that we can figure out what kind of facilities
> are necessary for such dynamism.
>
> Thanks.
>

Let me start from explaining current behavior.

- cpu-id is determined when a new processor(lapicid/x2apicid) is founded.
cpu-id<->nodeid relationship is _not_ recorded.

- node-id is determined when a new pxm(firmware info) is founded.
pxm<->nodeid relationship is recorded.

By this, there are 2 cases of cpu<->nodeid change.

Case A) In x86, cpus on memory-less nodes are all tied to existing nodes(round robin).
At memory-hotadd happens and a new node comes, cpus are moved to a newly added node
based on pxm.

Case B) Adding a node after removing another node, if pxm of them were different from
each other, cpu<->node relatiionship changes.

I personally thinks proper fix is building persistent cpu-id <-> lapicid relationship as
pxm does rather than creating band-aid.

But I have no good idea to hanlde case A), which is used now.
Hm, Case-A will not be problem for the case of workqueue's kmalloc because a node with
ZONE_NORMAL cannot be removed.

Thanks,
-Kame