On 10/6/07, David Rientjes <rientjes@google.com> wrote:cpuset_cpus_allowed() takes callback_mutex, which is held by update_cpumask() when it updates cs->cpus_allowed. So if we continue to hold callback_mutex across the task update loop this wouldn't be a race. Having said that, holding callback mutex for that long might not be a good idea. A cleaner solution might be to drop callback_mutex after updating cs->cpus_allowed in update_cpumask() and then make sched_setaffinity() do a post-check: cpus_allowed = cpuset_cpus_allowed(p); again: cpus_and(new_mask, new_mask, cpus_allowed); retval = set_cpus_allowed(p, new_mask); if (!retval) { /* Check for races with cpuset updates */ cpus_allowed = cpuset_cpus_allowed(p); if (!cpus_subset(new_mask, cpus_allowed)) { /* * We raced with a change to cpuset update, * and our cpumask is now outside the * permitted cpumask for the cpuset. Since a * change to the cpuset's cpus resets the * cpumask for each task, do the same thing * here. */ new_mask = cpus_allowed; goto again; } } Paul -
| Bart Van Assche | Integration of SCST in the mainstream Linux kernel |
| Linus Torvalds | Linux 2.6.27-rc5 |
| Jared Hulbert | [PATCH 00/10] AXFS: Advanced XIP filesystem |
| Linus Torvalds | Linux 2.6.27-rc8 |
git: | |
| David Miller | [GIT]: Networking |
| Antonio Almeida | HTB accuracy for high speed |
| Gerrit Renker | [PATCH 27/37] dccp: Integration of dynamic feature activation - part 2 (server side) |
| David Miller | Re: [PATCH] pkt_sched: Destroy gen estimators under rtnl_lock(). |
