diff options
Diffstat (limited to 'kernel/pid.c')
| -rw-r--r-- | kernel/pid.c | 12 | 
1 files changed, 7 insertions, 5 deletions
| diff --git a/kernel/pid.c b/kernel/pid.c index 047dc626463..0db3e791a06 100644 --- a/kernel/pid.c +++ b/kernel/pid.c @@ -36,6 +36,7 @@  #include <linux/pid_namespace.h>  #include <linux/init_task.h>  #include <linux/syscalls.h> +#include <linux/proc_ns.h>  #include <linux/proc_fs.h>  #define pid_hashfn(nr, ns)	\ @@ -51,9 +52,6 @@ int pid_max = PID_MAX_DEFAULT;  int pid_max_min = RESERVED_PIDS + 1;  int pid_max_max = PID_MAX_LIMIT; -#define BITS_PER_PAGE		(PAGE_SIZE*8) -#define BITS_PER_PAGE_MASK	(BITS_PER_PAGE-1) -  static inline int mk_pid(struct pid_namespace *pid_ns,  		struct pidmap *map, int off)  { @@ -183,15 +181,19 @@ static int alloc_pidmap(struct pid_namespace *pid_ns)  				break;  		}  		if (likely(atomic_read(&map->nr_free))) { -			do { +			for ( ; ; ) {  				if (!test_and_set_bit(offset, map->page)) {  					atomic_dec(&map->nr_free);  					set_last_pid(pid_ns, last, pid);  					return pid;  				}  				offset = find_next_offset(map, offset); +				if (offset >= BITS_PER_PAGE) +					break;  				pid = mk_pid(pid_ns, map, offset); -			} while (offset < BITS_PER_PAGE && pid < pid_max); +				if (pid >= pid_max) +					break; +			}  		}  		if (map < &pid_ns->pidmap[(pid_max-1)/BITS_PER_PAGE]) {  			++map; | 
