diff options
author | Serge E. Hallyn <serue@us.ibm.com> | 2007-10-19 02:39:52 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-19 14:53:37 -0400 |
commit | b460cbc581a53cc088ceba80608021dd49c63c43 (patch) | |
tree | 83c28d0adbc15f4157c77b40fa60c40a71cb8673 /arch/x86 | |
parent | 3743ca05ff464b8a9e345c08a6c9ce30485f9805 (diff) |
pid namespaces: define is_global_init() and is_container_init()
is_init() is an ambiguous name for the pid==1 check. Split it into
is_global_init() and is_container_init().
A cgroup init has it's tsk->pid == 1.
A global init also has it's tsk->pid == 1 and it's active pid namespace
is the init_pid_ns. But rather than check the active pid namespace,
compare the task structure with 'init_pid_ns.child_reaper', which is
initialized during boot to the /sbin/init process and never changes.
Changelog:
2.6.22-rc4-mm2-pidns1:
- Use 'init_pid_ns.child_reaper' to determine if a given task is the
global init (/sbin/init) process. This would improve performance
and remove dependence on the task_pid().
2.6.21-mm2-pidns2:
- [Sukadev Bhattiprolu] Changed is_container_init() calls in {powerpc,
ppc,avr32}/traps.c for the _exception() call to is_global_init().
This way, we kill only the cgroup if the cgroup's init has a
bug rather than force a kernel panic.
[akpm@linux-foundation.org: fix comment]
[sukadev@us.ibm.com: Use is_global_init() in arch/m32r/mm/fault.c]
[bunk@stusta.de: kernel/pid.c: remove unused exports]
[sukadev@us.ibm.com: Fix capability.c to work with threaded init]
Signed-off-by: Serge E. Hallyn <serue@us.ibm.com>
Signed-off-by: Sukadev Bhattiprolu <sukadev@us.ibm.com>
Acked-by: Pavel Emelianov <xemul@openvz.org>
Cc: Eric W. Biederman <ebiederm@xmission.com>
Cc: Cedric Le Goater <clg@fr.ibm.com>
Cc: Dave Hansen <haveblue@us.ibm.com>
Cc: Herbert Poetzel <herbert@13thfloor.at>
Cc: Kirill Korotaev <dev@sw.ru>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/x86')
-rw-r--r-- | arch/x86/lib/usercopy_32.c | 2 | ||||
-rw-r--r-- | arch/x86/mm/fault_32.c | 2 | ||||
-rw-r--r-- | arch/x86/mm/fault_64.c | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/arch/x86/lib/usercopy_32.c b/arch/x86/lib/usercopy_32.c index 9f38b12b4af1..8bab2b2efaff 100644 --- a/arch/x86/lib/usercopy_32.c +++ b/arch/x86/lib/usercopy_32.c | |||
@@ -748,7 +748,7 @@ survive: | |||
748 | retval = get_user_pages(current, current->mm, | 748 | retval = get_user_pages(current, current->mm, |
749 | (unsigned long )to, 1, 1, 0, &pg, NULL); | 749 | (unsigned long )to, 1, 1, 0, &pg, NULL); |
750 | 750 | ||
751 | if (retval == -ENOMEM && is_init(current)) { | 751 | if (retval == -ENOMEM && is_global_init(current)) { |
752 | up_read(¤t->mm->mmap_sem); | 752 | up_read(¤t->mm->mmap_sem); |
753 | congestion_wait(WRITE, HZ/50); | 753 | congestion_wait(WRITE, HZ/50); |
754 | goto survive; | 754 | goto survive; |
diff --git a/arch/x86/mm/fault_32.c b/arch/x86/mm/fault_32.c index 6555c3d14371..4fc5e400cf0a 100644 --- a/arch/x86/mm/fault_32.c +++ b/arch/x86/mm/fault_32.c | |||
@@ -587,7 +587,7 @@ no_context: | |||
587 | */ | 587 | */ |
588 | out_of_memory: | 588 | out_of_memory: |
589 | up_read(&mm->mmap_sem); | 589 | up_read(&mm->mmap_sem); |
590 | if (is_init(tsk)) { | 590 | if (is_global_init(tsk)) { |
591 | yield(); | 591 | yield(); |
592 | down_read(&mm->mmap_sem); | 592 | down_read(&mm->mmap_sem); |
593 | goto survive; | 593 | goto survive; |
diff --git a/arch/x86/mm/fault_64.c b/arch/x86/mm/fault_64.c index 5e0e54906c48..5149ac136a5d 100644 --- a/arch/x86/mm/fault_64.c +++ b/arch/x86/mm/fault_64.c | |||
@@ -554,7 +554,7 @@ no_context: | |||
554 | */ | 554 | */ |
555 | out_of_memory: | 555 | out_of_memory: |
556 | up_read(&mm->mmap_sem); | 556 | up_read(&mm->mmap_sem); |
557 | if (is_init(current)) { | 557 | if (is_global_init(current)) { |
558 | yield(); | 558 | yield(); |
559 | goto again; | 559 | goto again; |
560 | } | 560 | } |