diff options
Diffstat (limited to 'kernel/pid.c')
-rw-r--r-- | kernel/pid.c | 13 |
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) | |||
149 | return -1; | 149 | return -1; |
150 | } | 150 | } |
151 | 151 | ||
152 | static int next_pidmap(int last) | 152 | static int next_pidmap(struct pspace *pspace, int last) |
153 | { | 153 | { |
154 | int offset; | 154 | int offset; |
155 | struct pidmap *map; | 155 | struct pidmap *map, *end; |
156 | 156 | ||
157 | offset = (last + 1) & BITS_PER_PAGE_MASK; | 157 | offset = (last + 1) & BITS_PER_PAGE_MASK; |
158 | map = &pidmap_array[(last + 1)/BITS_PER_PAGE]; | 158 | map = &pspace->pidmap[(last + 1)/BITS_PER_PAGE]; |
159 | for (; map < &pidmap_array[PIDMAP_ENTRIES]; map++, offset = 0) { | 159 | end = &pspace->pidmap[PIDMAP_ENTRIES]; |
160 | for (; map < end; map++, offset = 0) { | ||
160 | if (unlikely(!map->page)) | 161 | if (unlikely(!map->page)) |
161 | continue; | 162 | continue; |
162 | offset = find_next_bit((map)->page, BITS_PER_PAGE, offset); | 163 | offset = find_next_bit((map)->page, BITS_PER_PAGE, offset); |
163 | if (offset < BITS_PER_PAGE) | 164 | if (offset < BITS_PER_PAGE) |
164 | return mk_pid(map, offset); | 165 | return mk_pid(pspace, map, offset); |
165 | } | 166 | } |
166 | return -1; | 167 | return -1; |
167 | } | 168 | } |
@@ -338,7 +339,7 @@ struct pid *find_ge_pid(int nr) | |||
338 | pid = find_pid(nr); | 339 | pid = find_pid(nr); |
339 | if (pid) | 340 | if (pid) |
340 | break; | 341 | break; |
341 | nr = next_pidmap(nr); | 342 | nr = next_pidmap(&init_pspace, nr); |
342 | } while (nr > 0); | 343 | } while (nr > 0); |
343 | 344 | ||
344 | return pid; | 345 | return pid; |