diff options
| author | Sukadev Bhattiprolu <sukadev@us.ibm.com> | 2006-10-02 05:17:23 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-10-02 10:57:15 -0400 |
| commit | aa5a6662f93f52605b6c447ba6f7291e92f515c5 (patch) | |
| tree | 233cfe0942063c81a582d8451ddd2a38d40566e9 | |
| parent | d387cae075b0aec479adbdfb71df39f7de8e9adb (diff) | |
[PATCH] Move pidmap to pspace.h
Move struct pidmap and PIDMAP_ENTRIES to a new file, include/linux/pspace.h
where it will be used in subsequent patches to define pid spaces.
Its a subset of Eric Biederman's patch http://lkml.org/lkml/2006/2/6/285
[akpm@osdl.org: cleanups]
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: Sukadev Bhattiprolu <sukadev@us.ibm.com>
Cc: Dave Hansen <haveblue@us.ibm.com>
Cc: Serge Hallyn <serue@us.ibm.com>
Cc: Cedric Le Goater <clg@fr.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
| -rw-r--r-- | include/linux/pspace.h | 16 | ||||
| -rw-r--r-- | kernel/pid.c | 7 |
2 files changed, 17 insertions, 6 deletions
diff --git a/include/linux/pspace.h b/include/linux/pspace.h new file mode 100644 index 000000000000..a8a064b0ad18 --- /dev/null +++ b/include/linux/pspace.h | |||
| @@ -0,0 +1,16 @@ | |||
| 1 | #ifndef _LINUX_PSPACE_H | ||
| 2 | #define _LINUX_PSPACE_H | ||
| 3 | |||
| 4 | #include <linux/sched.h> | ||
| 5 | #include <linux/mm.h> | ||
| 6 | #include <linux/threads.h> | ||
| 7 | #include <linux/pid.h> | ||
| 8 | |||
| 9 | struct pidmap { | ||
| 10 | atomic_t nr_free; | ||
| 11 | void *page; | ||
| 12 | }; | ||
| 13 | |||
| 14 | #define PIDMAP_ENTRIES ((PID_MAX_LIMIT + 8*PAGE_SIZE - 1)/PAGE_SIZE/8) | ||
| 15 | |||
| 16 | #endif /* _LINUX_PSPACE_H */ | ||
diff --git a/kernel/pid.c b/kernel/pid.c index 373639a10d84..8234bd08a3cb 100644 --- a/kernel/pid.c +++ b/kernel/pid.c | |||
| @@ -26,6 +26,7 @@ | |||
| 26 | #include <linux/init.h> | 26 | #include <linux/init.h> |
| 27 | #include <linux/bootmem.h> | 27 | #include <linux/bootmem.h> |
| 28 | #include <linux/hash.h> | 28 | #include <linux/hash.h> |
| 29 | #include <linux/pspace.h> | ||
| 29 | 30 | ||
| 30 | #define pid_hashfn(nr) hash_long((unsigned long)nr, pidhash_shift) | 31 | #define pid_hashfn(nr) hash_long((unsigned long)nr, pidhash_shift) |
| 31 | static struct hlist_head *pid_hash; | 32 | static struct hlist_head *pid_hash; |
| @@ -40,7 +41,6 @@ int last_pid; | |||
| 40 | int pid_max_min = RESERVED_PIDS + 1; | 41 | int pid_max_min = RESERVED_PIDS + 1; |
| 41 | int pid_max_max = PID_MAX_LIMIT; | 42 | int pid_max_max = PID_MAX_LIMIT; |
| 42 | 43 | ||
| 43 | #define PIDMAP_ENTRIES ((PID_MAX_LIMIT + 8*PAGE_SIZE - 1)/PAGE_SIZE/8) | ||
| 44 | #define BITS_PER_PAGE (PAGE_SIZE*8) | 44 | #define BITS_PER_PAGE (PAGE_SIZE*8) |
| 45 | #define BITS_PER_PAGE_MASK (BITS_PER_PAGE-1) | 45 | #define BITS_PER_PAGE_MASK (BITS_PER_PAGE-1) |
| 46 | #define mk_pid(map, off) (((map) - pidmap_array)*BITS_PER_PAGE + (off)) | 46 | #define mk_pid(map, off) (((map) - pidmap_array)*BITS_PER_PAGE + (off)) |
| @@ -53,11 +53,6 @@ int pid_max_max = PID_MAX_LIMIT; | |||
| 53 | * value does not cause lots of bitmaps to be allocated, but | 53 | * value does not cause lots of bitmaps to be allocated, but |
| 54 | * the scheme scales to up to 4 million PIDs, runtime. | 54 | * the scheme scales to up to 4 million PIDs, runtime. |
| 55 | */ | 55 | */ |
| 56 | struct pidmap { | ||
| 57 | atomic_t nr_free; | ||
| 58 | void *page; | ||
| 59 | }; | ||
| 60 | |||
| 61 | static struct pidmap pidmap_array[PIDMAP_ENTRIES] = | 56 | static struct pidmap pidmap_array[PIDMAP_ENTRIES] = |
| 62 | { [ 0 ... PIDMAP_ENTRIES-1 ] = { ATOMIC_INIT(BITS_PER_PAGE), NULL } }; | 57 | { [ 0 ... PIDMAP_ENTRIES-1 ] = { ATOMIC_INIT(BITS_PER_PAGE), NULL } }; |
| 63 | 58 | ||
