diff options
author | Tejun Heo <tj@kernel.org> | 2016-01-19 12:18:41 -0500 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2016-01-22 10:22:46 -0500 |
commit | e93ad19d05648397ef3bcb838d26aec06c245dc0 (patch) | |
tree | 9b5587594c7f589c87cf476ae45835d837058a7f /include/linux/cpuset.h | |
parent | 3e1e21c7bfcfa9bf06c07f48a13faca2f62b3339 (diff) | |
download | linux-stable-e93ad19d05648397ef3bcb838d26aec06c245dc0.tar.gz linux-stable-e93ad19d05648397ef3bcb838d26aec06c245dc0.tar.bz2 linux-stable-e93ad19d05648397ef3bcb838d26aec06c245dc0.zip |
cpuset: make mm migration asynchronous
If "cpuset.memory_migrate" is set, when a process is moved from one
cpuset to another with a different memory node mask, pages in used by
the process are migrated to the new set of nodes. This was performed
synchronously in the ->attach() callback, which is synchronized
against process management. Recently, the synchronization was changed
from per-process rwsem to global percpu rwsem for simplicity and
optimization.
Combined with the synchronous mm migration, this led to deadlocks
because mm migration could schedule a work item which may in turn try
to create a new worker blocking on the process management lock held
from cgroup process migration path.
This heavy an operation shouldn't be performed synchronously from that
deep inside cgroup migration in the first place. This patch punts the
actual migration to an ordered workqueue and updates cgroup process
migration and cpuset config update paths to flush the workqueue after
all locks are released. This way, the operations still seem
synchronous to userland without entangling mm migration with process
management synchronization. CPU hotplug can also invoke mm migration
but there's no reason for it to wait for mm migrations and thus
doesn't synchronize against their completions.
Signed-off-by: Tejun Heo <tj@kernel.org>
Reported-and-tested-by: Christian Borntraeger <borntraeger@de.ibm.com>
Cc: stable@vger.kernel.org # v4.4+
Diffstat (limited to 'include/linux/cpuset.h')
-rw-r--r-- | include/linux/cpuset.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/include/linux/cpuset.h b/include/linux/cpuset.h index 85a868ccb493..fea160ee5803 100644 --- a/include/linux/cpuset.h +++ b/include/linux/cpuset.h @@ -137,6 +137,8 @@ static inline void set_mems_allowed(nodemask_t nodemask) task_unlock(current); } +extern void cpuset_post_attach_flush(void); + #else /* !CONFIG_CPUSETS */ static inline bool cpusets_enabled(void) { return false; } @@ -243,6 +245,10 @@ static inline bool read_mems_allowed_retry(unsigned int seq) return false; } +static inline void cpuset_post_attach_flush(void) +{ +} + #endif /* !CONFIG_CPUSETS */ #endif /* _LINUX_CPUSET_H */ |