Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1236751 > unrolled thread

[RFC 2/4] pid_namespace: remove .kref field for !CONFIG_PID_NS

Started byRasmus Villemoes <linux@rasmusvillemoes.dk>
First post2015-09-30 23:00 +0200
Last post2015-09-30 23:00 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [RFC 2/4] pid_namespace: remove .kref field for !CONFIG_PID_NS Rasmus Villemoes <linux@rasmusvillemoes.dk> - 2015-09-30 23:00 +0200

#1236751 — [RFC 2/4] pid_namespace: remove .kref field for !CONFIG_PID_NS

FromRasmus Villemoes <linux@rasmusvillemoes.dk>
Date2015-09-30 23:00 +0200
Subject[RFC 2/4] pid_namespace: remove .kref field for !CONFIG_PID_NS
Message-ID<qewDM-7OB-9@gated-at.bofh.it>
When there's only one global pid_namespace (init_pid_ns), the kref
field is unused (since both get_pid_ns and put_pid_ns are
no-ops). While we only save a few bytes by removing it, it could also
help catch users manipulating ->kref directly.

Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
---
 include/linux/pid_namespace.h | 2 ++
 kernel/pid.c                  | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/include/linux/pid_namespace.h b/include/linux/pid_namespace.h
index 03a84a0cdc75..1cac17eb0775 100644
--- a/include/linux/pid_namespace.h
+++ b/include/linux/pid_namespace.h
@@ -22,7 +22,9 @@ struct pidmap {
 struct fs_pin;
 
 struct pid_namespace {
+#ifdef CONFIG_PID_NS
 	struct kref kref;
+#endif
 	struct pidmap pidmap[PIDMAP_ENTRIES];
 	struct rcu_head rcu;
 	int last_pid;
diff --git a/kernel/pid.c b/kernel/pid.c
index 909d3dcd8085..25332679a4d3 100644
--- a/kernel/pid.c
+++ b/kernel/pid.c
@@ -68,9 +68,11 @@ static inline int mk_pid(struct pid_namespace *pid_ns,
  * the scheme scales to up to 4 million PIDs, runtime.
  */
 struct pid_namespace init_pid_ns = {
+#ifdef CONFIG_PID_NS
 	.kref = {
 		.refcount       = ATOMIC_INIT(2),
 	},
+#endif
 	.pidmap = {
 		[ 0 ... PIDMAP_ENTRIES-1] = { ATOMIC_INIT(BITS_PER_PAGE), NULL }
 	},
-- 
2.1.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web