Skip to content

Commit 5cc5445

Browse files
raphaelsctorvalds
authored andcommitted
pid_namespace.c/.h: simplify defines
Move BITS_PER_PAGE from pid_namespace.c to pid_namespace.h, since we can simplify the define PID_MAP_ENTRIES by using the BITS_PER_PAGE. [akpm@linux-foundation.org: kernel/pid.c:54:1: warning: "BITS_PER_PAGE" redefined] Signed-off-by: Raphael S.Carvalho <raphael.scarv@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 8db049b commit 5cc5445

3 files changed

Lines changed: 3 additions & 6 deletions

File tree

‎include/linux/pid_namespace.h‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ struct pidmap {
1313
void *page;
1414
};
1515

16-
#define PIDMAP_ENTRIES ((PID_MAX_LIMIT + 8*PAGE_SIZE - 1)/PAGE_SIZE/8)
16+
#define BITS_PER_PAGE (PAGE_SIZE * 8)
17+
#define BITS_PER_PAGE_MASK (BITS_PER_PAGE-1)
18+
#define PIDMAP_ENTRIES ((PID_MAX_LIMIT+BITS_PER_PAGE-1)/BITS_PER_PAGE)
1719

1820
struct bsd_acct_struct;
1921

‎kernel/pid.c‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,6 @@ int pid_max = PID_MAX_DEFAULT;
5151
int pid_max_min = RESERVED_PIDS + 1;
5252
int pid_max_max = PID_MAX_LIMIT;
5353

54-
#define BITS_PER_PAGE (PAGE_SIZE*8)
55-
#define BITS_PER_PAGE_MASK (BITS_PER_PAGE-1)
56-
5754
static inline int mk_pid(struct pid_namespace *pid_ns,
5855
struct pidmap *map, int off)
5956
{

‎kernel/pid_namespace.c‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
1919
#include <linux/reboot.h>
2020
#include <linux/export.h>
2121

22-
#define BITS_PER_PAGE (PAGE_SIZE*8)
23-
2422
struct pid_cache {
2523
int nr_ids;
2624
char name[16];

0 commit comments

Comments
 (0)