Re: [PATCH v3 5/5] cpusets, suspend: Save and restore cpusets duringsuspend/resume

From: David Rientjes
Date: Tue May 15 2012 - 00:04:46 EST

On Mon, 14 May 2012, Nishanth Aravamudan wrote:

> > I see what you're doing with this and think it will fix the problem that
> > you're trying to address, but I think it could become much more general
> > to just the suspend case: if an admin sets a cpuset to have cpus 4-6, for
> > example, and cpu 5 goes offline, then I believe the cpuset should once
> > again become 4-6 if cpu 5 comes back online. So I think this should be
> > implemented like mempolicies are which save the user intended nodemask
> > that may become restricted by cpuset placement but will be rebound if the
> > cpuset includes the intended nodes.
> Heh, please read the thread at
> ... subject is
> "[PATCH v2 0/7] CPU hotplug, cpusets: Fix issues with cpusets handling
> upon CPU hotplug". That was effectively the same solution Srivatsa
> originally posted. But after lengthy discussions with PeterZ and others,
> it was decided that suspend/resume is a special case where it makes
> sense to save "policy" but that generally cpu/memory hotplug is a
> destructive operation and nothing is required to be retained (that
> certain policies are retained is unfortunately now expected, but isn't
> guaranteed for cpusets, at least).

If you do set_mempolicy(MPOL_BIND, 2-3) to bind a thread to nodes 2-3 that
is attached to a cpuset whereas cpuset.mems == 2-3, and then cpuset.mems
changes to 0-1, what is the expected behavior? Do we immediately oom on
the next allocation? If cpuset.mems is set again to 2-3, what's the
desired behavior?

I fixed this problem by introducing MPOL_F_* flags in set_mempolicy(2) by
saving the user intended nodemask passed by set_mempolicy() and respecting
it whenever allowed by cpusets.

Right now, the behavior of what happens for a cpuset where cpuset.cpus ==
2-3 and then cpus 2-3 go offline and then are brought back online is
undefined. The same is true of cpuset.cpus during resume. So if you're
going to add a cpumask to struct cpuset, then why not respect it for all
offline events and get rid of all this specialized suspend-only stuff?
It's very simple to make this consistent across all cpu hotplug events and
build suspend on top of it from a cpuset perspective.
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at