summaryrefslogtreecommitdiff
path: root/kernel/pid.c
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2006-10-02 02:17:25 -0700
committerLinus Torvalds <torvalds@g5.osdl.org>2006-10-02 07:57:15 -0700
commitf40f50d3bb33b52dfd550ca80be7daaddad21883 (patch)
tree4197df6e1da9e986dc6a1a6cb507844ad0ae53fe /kernel/pid.c
parent3fbc96486459324e182717b03c50c90c880be6ec (diff)
downloadlwn-f40f50d3bb33b52dfd550ca80be7daaddad21883.tar.gz
lwn-f40f50d3bb33b52dfd550ca80be7daaddad21883.zip
[PATCH] Use struct pspace in next_pidmap and find_ge_pid
This updates my proc: readdir race fix (take 3) patch to account for the changes made by: Sukadev Bhattiprolu <sukadev@us.ibm.com> to introduce struct pspace. Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'kernel/pid.c')
-rw-r--r--kernel/pid.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/kernel/pid.c b/kernel/pid.c
index 89107b7481af..e4779bbb2058 100644
--- a/kernel/pid.c
+++ b/kernel/pid.c
@@ -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;
}
@@ -338,7 +339,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;