diff options
author | Paul Jackson <pj@sgi.com> | 2006-01-14 16:21:06 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-01-14 21:27:10 -0500 |
commit | 505970b96e3b7d22177c38e03435a68376628e7a (patch) | |
tree | 5508317e391961355bf3d946a6aac05bb21569eb /include/linux | |
parent | ed68cb3676bb179768529aeb808403d57295af56 (diff) |
[PATCH] cpuset oom lock fix
The problem, reported in:
http://bugzilla.kernel.org/show_bug.cgi?id=5859
and by various other email messages and lkml posts is that the cpuset hook
in the oom (out of memory) code can try to take a cpuset semaphore while
holding the tasklist_lock (a spinlock).
One must not sleep while holding a spinlock.
The fix seems easy enough - move the cpuset semaphore region outside the
tasklist_lock region.
This required a few lines of mechanism to implement. The oom code where
the locking needs to be changed does not have access to the cpuset locks,
which are internal to kernel/cpuset.c only. So I provided a couple more
cpuset interface routines, available to the rest of the kernel, which
simple take and drop the lock needed here (cpusets callback_sem).
Signed-off-by: Paul Jackson <pj@sgi.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include/linux')
-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 c472f972bd6d..3bc606927116 100644 --- a/include/linux/cpuset.h +++ b/include/linux/cpuset.h | |||
@@ -48,6 +48,9 @@ extern void __cpuset_memory_pressure_bump(void); | |||
48 | extern struct file_operations proc_cpuset_operations; | 48 | extern struct file_operations proc_cpuset_operations; |
49 | extern char *cpuset_task_status_allowed(struct task_struct *task, char *buffer); | 49 | extern char *cpuset_task_status_allowed(struct task_struct *task, char *buffer); |
50 | 50 | ||
51 | extern void cpuset_lock(void); | ||
52 | extern void cpuset_unlock(void); | ||
53 | |||
51 | #else /* !CONFIG_CPUSETS */ | 54 | #else /* !CONFIG_CPUSETS */ |
52 | 55 | ||
53 | static inline int cpuset_init_early(void) { return 0; } | 56 | static inline int cpuset_init_early(void) { return 0; } |
@@ -93,6 +96,9 @@ static inline char *cpuset_task_status_allowed(struct task_struct *task, | |||
93 | return buffer; | 96 | return buffer; |
94 | } | 97 | } |
95 | 98 | ||
99 | static inline void cpuset_lock(void) {} | ||
100 | static inline void cpuset_unlock(void) {} | ||
101 | |||
96 | #endif /* !CONFIG_CPUSETS */ | 102 | #endif /* !CONFIG_CPUSETS */ |
97 | 103 | ||
98 | #endif /* _LINUX_CPUSET_H */ | 104 | #endif /* _LINUX_CPUSET_H */ |