Merge branch 'upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/vitb/linux...
[pandora-kernel.git] / kernel / pid.c
index 89107b7..b914392 100644 (file)
@@ -149,19 +149,20 @@ static int alloc_pidmap(struct pspace *pspace)
        return -1;
 }
 
-static int next_pidmap(int last)
+static int next_pidmap(struct pspace *pspace, int last)
 {
        int offset;
-       struct pidmap *map;
+       struct pidmap *map, *end;
 
        offset = (last + 1) & BITS_PER_PAGE_MASK;
-       map = &pidmap_array[(last + 1)/BITS_PER_PAGE];
-       for (; map < &pidmap_array[PIDMAP_ENTRIES]; map++, offset = 0) {
+       map = &pspace->pidmap[(last + 1)/BITS_PER_PAGE];
+       end = &pspace->pidmap[PIDMAP_ENTRIES];
+       for (; map < end; map++, offset = 0) {
                if (unlikely(!map->page))
                        continue;
                offset = find_next_bit((map)->page, BITS_PER_PAGE, offset);
                if (offset < BITS_PER_PAGE)
-                       return mk_pid(map, offset);
+                       return mk_pid(pspace, map, offset);
        }
        return -1;
 }
@@ -303,6 +304,15 @@ struct task_struct *find_task_by_pid_type(int type, int nr)
 
 EXPORT_SYMBOL(find_task_by_pid_type);
 
+struct pid *get_task_pid(struct task_struct *task, enum pid_type type)
+{
+       struct pid *pid;
+       rcu_read_lock();
+       pid = get_pid(task->pids[type].pid);
+       rcu_read_unlock();
+       return pid;
+}
+
 struct task_struct *fastcall get_pid_task(struct pid *pid, enum pid_type type)
 {
        struct task_struct *result;
@@ -338,7 +348,7 @@ struct pid *find_ge_pid(int nr)
                pid = find_pid(nr);
                if (pid)
                        break;
-               nr = next_pidmap(nr);
+               nr = next_pidmap(&init_pspace, nr);
        } while (nr > 0);
 
        return pid;