aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorOleg Nesterov <oleg@tv-sign.ru>2008-07-25 04:47:38 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-07-25 13:53:39 -0400
commit246bb0b1deb29726990620d8b5e55ca29f331362 (patch)
tree5173b9e0c1d18934a8b2693c690a7162acb1bca8 /include/linux
parent7b34e4283c685f5cc6ba6d30e939906eee0d4bcf (diff)
kill PF_BORROWED_MM in favour of PF_KTHREAD
Kill PF_BORROWED_MM. Change use_mm/unuse_mm to not play with ->flags, and do s/PF_BORROWED_MM/PF_KTHREAD/ for a couple of other users. No functional changes yet. But this allows us to do further fixes/cleanups. oom_kill/ptrace/etc often check "p->mm != NULL" to filter out the kthreads, this is wrong because of use_mm(). The problem with PF_BORROWED_MM is that we need task_lock() to avoid races. With this patch we can check PF_KTHREAD directly, or use a simple lockless helper: /* The result must not be dereferenced !!! */ struct mm_struct *__get_task_mm(struct task_struct *tsk) { if (tsk->flags & PF_KTHREAD) return NULL; return tsk->mm; } Note also ecard_task(). It runs with ->mm != NULL, but it's the kernel thread without PF_BORROWED_MM. Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru> Cc: Roland McGrath <roland@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/sched.h3
1 files changed, 1 insertions, 2 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h
index eec64a4adb9d..0560999eb1db 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1483,7 +1483,6 @@ static inline void put_task_struct(struct task_struct *t)
1483#define PF_EXITING 0x00000004 /* getting shut down */ 1483#define PF_EXITING 0x00000004 /* getting shut down */
1484#define PF_EXITPIDONE 0x00000008 /* pi exit done on shut down */ 1484#define PF_EXITPIDONE 0x00000008 /* pi exit done on shut down */
1485#define PF_VCPU 0x00000010 /* I'm a virtual CPU */ 1485#define PF_VCPU 0x00000010 /* I'm a virtual CPU */
1486#define PF_KTHREAD 0x00000020 /* I am a kernel thread */
1487#define PF_FORKNOEXEC 0x00000040 /* forked but didn't exec */ 1486#define PF_FORKNOEXEC 0x00000040 /* forked but didn't exec */
1488#define PF_SUPERPRIV 0x00000100 /* used super-user privileges */ 1487#define PF_SUPERPRIV 0x00000100 /* used super-user privileges */
1489#define PF_DUMPCORE 0x00000200 /* dumped core */ 1488#define PF_DUMPCORE 0x00000200 /* dumped core */
@@ -1497,7 +1496,7 @@ static inline void put_task_struct(struct task_struct *t)
1497#define PF_KSWAPD 0x00040000 /* I am kswapd */ 1496#define PF_KSWAPD 0x00040000 /* I am kswapd */
1498#define PF_SWAPOFF 0x00080000 /* I am in swapoff */ 1497#define PF_SWAPOFF 0x00080000 /* I am in swapoff */
1499#define PF_LESS_THROTTLE 0x00100000 /* Throttle me less: I clean memory */ 1498#define PF_LESS_THROTTLE 0x00100000 /* Throttle me less: I clean memory */
1500#define PF_BORROWED_MM 0x00200000 /* I am a kthread doing use_mm */ 1499#define PF_KTHREAD 0x00200000 /* I am a kernel thread */
1501#define PF_RANDOMIZE 0x00400000 /* randomize virtual address space */ 1500#define PF_RANDOMIZE 0x00400000 /* randomize virtual address space */
1502#define PF_SWAPWRITE 0x00800000 /* Allowed to write to swap */ 1501#define PF_SWAPWRITE 0x00800000 /* Allowed to write to swap */
1503#define PF_SPREAD_PAGE 0x01000000 /* Spread page cache over cpuset */ 1502#define PF_SPREAD_PAGE 0x01000000 /* Spread page cache over cpuset */