sched/cputime: Fix steal time accounting vs. CPU hotplug
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / kernel / pid_namespace.c
index 4af28a84906545765c1429461e166c4d362e765c..e32703d5e0ab7c05083efb1eef9a67ad40fa0f2c 100644 (file)
@@ -19,8 +19,6 @@
 #include <linux/reboot.h>
 #include <linux/export.h>
 
-#define BITS_PER_PAGE          (PAGE_SIZE*8)
-
 struct pid_cache {
        int nr_ids;
        char name[16];
@@ -181,6 +179,7 @@ void zap_pid_ns_processes(struct pid_namespace *pid_ns)
        int nr;
        int rc;
        struct task_struct *task, *me = current;
+       int init_pids = thread_group_leader(me) ? 1 : 2;
 
        /* Don't allow any more processes into the pid namespace */
        disable_pid_allocation(pid_ns);
@@ -230,7 +229,7 @@ void zap_pid_ns_processes(struct pid_namespace *pid_ns)
         */
        for (;;) {
                set_current_state(TASK_UNINTERRUPTIBLE);
-               if (pid_ns->nr_hashed == 1)
+               if (pid_ns->nr_hashed == init_pids)
                        break;
                schedule();
        }
@@ -313,7 +312,9 @@ static void *pidns_get(struct task_struct *task)
        struct pid_namespace *ns;
 
        rcu_read_lock();
-       ns = get_pid_ns(task_active_pid_ns(task));
+       ns = task_active_pid_ns(task);
+       if (ns)
+               get_pid_ns(ns);
        rcu_read_unlock();
 
        return ns;