[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>
This commit is contained in:
parent
3fbc964864
commit
f40f50d3bb
13
kernel/pid.c
13
kernel/pid.c
@ -149,19 +149,20 @@ static int alloc_pidmap(struct pspace *pspace)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int next_pidmap(int last)
|
static int next_pidmap(struct pspace *pspace, int last)
|
||||||
{
|
{
|
||||||
int offset;
|
int offset;
|
||||||
struct pidmap *map;
|
struct pidmap *map, *end;
|
||||||
|
|
||||||
offset = (last + 1) & BITS_PER_PAGE_MASK;
|
offset = (last + 1) & BITS_PER_PAGE_MASK;
|
||||||
map = &pidmap_array[(last + 1)/BITS_PER_PAGE];
|
map = &pspace->pidmap[(last + 1)/BITS_PER_PAGE];
|
||||||
for (; map < &pidmap_array[PIDMAP_ENTRIES]; map++, offset = 0) {
|
end = &pspace->pidmap[PIDMAP_ENTRIES];
|
||||||
|
for (; map < end; map++, offset = 0) {
|
||||||
if (unlikely(!map->page))
|
if (unlikely(!map->page))
|
||||||
continue;
|
continue;
|
||||||
offset = find_next_bit((map)->page, BITS_PER_PAGE, offset);
|
offset = find_next_bit((map)->page, BITS_PER_PAGE, offset);
|
||||||
if (offset < BITS_PER_PAGE)
|
if (offset < BITS_PER_PAGE)
|
||||||
return mk_pid(map, offset);
|
return mk_pid(pspace, map, offset);
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -338,7 +339,7 @@ struct pid *find_ge_pid(int nr)
|
|||||||
pid = find_pid(nr);
|
pid = find_pid(nr);
|
||||||
if (pid)
|
if (pid)
|
||||||
break;
|
break;
|
||||||
nr = next_pidmap(nr);
|
nr = next_pidmap(&init_pspace, nr);
|
||||||
} while (nr > 0);
|
} while (nr > 0);
|
||||||
|
|
||||||
return pid;
|
return pid;
|
||||||
|
Loading…
Reference in New Issue
Block a user