From: Rasmus Villemoes <linux@rasmusvillemoes.dk>
To: "Eric W. Biederman" <ebiederm@xmission.com>,
Oleg Nesterov <oleg@redhat.com>
Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>,
linux-kernel@vger.kernel.org
Subject: [RFC 3/4] pid_namespace: make pid_nr_ns and pid_vnr static inlines for !CONFIG_PID_NS
Date: Wed, 30 Sep 2015 22:49:22 +0200 [thread overview]
Message-ID: <1443646163-31316-4-git-send-email-linux@rasmusvillemoes.dk> (raw)
In-Reply-To: <1443646163-31316-1-git-send-email-linux@rasmusvillemoes.dk>
When there is only a single pid namespace, pid_nr_ns and pid_vnr
perform the same task as pid_nr, so we can save a little .text by
making them simple inlines.
Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
---
include/linux/pid.h | 11 +++++++++++
kernel/pid.c | 2 ++
2 files changed, 13 insertions(+)
diff --git a/include/linux/pid.h b/include/linux/pid.h
index 23705a53abba..9aba74a90a64 100644
--- a/include/linux/pid.h
+++ b/include/linux/pid.h
@@ -169,8 +169,19 @@ static inline pid_t pid_nr(struct pid *pid)
return nr;
}
+#ifdef CONFIG_PID_NS
pid_t pid_nr_ns(struct pid *pid, struct pid_namespace *ns);
pid_t pid_vnr(struct pid *pid);
+#else
+static inline pid_t pid_nr_ns(struct pid *pid, struct pid_namespace *ns)
+{
+ return pid_nr(pid);
+}
+static inline pid_t pid_vnr(struct pid *pid)
+{
+ return pid_nr(pid);
+}
+#endif
#define do_each_pid_task(pid, type, task) \
do { \
diff --git a/kernel/pid.c b/kernel/pid.c
index 25332679a4d3..d422ddae0484 100644
--- a/kernel/pid.c
+++ b/kernel/pid.c
@@ -499,6 +499,7 @@ struct pid *find_get_pid(pid_t nr)
}
EXPORT_SYMBOL_GPL(find_get_pid);
+#ifdef CONFIG_PID_NS
pid_t pid_nr_ns(struct pid *pid, struct pid_namespace *ns)
{
struct upid *upid;
@@ -518,6 +519,7 @@ pid_t pid_vnr(struct pid *pid)
return pid_nr_ns(pid, task_active_pid_ns(current));
}
EXPORT_SYMBOL_GPL(pid_vnr);
+#endif
pid_t __task_pid_nr_ns(struct task_struct *task, enum pid_type type,
struct pid_namespace *ns)
--
2.1.3
next prev parent reply other threads:[~2015-09-30 20:50 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-30 20:49 [RFC 0/4] reduce pid_namespace footprint when not configured Rasmus Villemoes
2015-09-30 20:49 ` [RFC 1/4] pid_namespace: remove ->level and ->parent for !CONFIG_PID_NS Rasmus Villemoes
2015-09-30 20:49 ` [RFC 2/4] pid_namespace: remove .kref field " Rasmus Villemoes
2015-09-30 20:49 ` Rasmus Villemoes [this message]
2015-09-30 20:49 ` [RFC 4/4] pid_namespace: disable_pid_allocation is unused " Rasmus Villemoes
2015-09-30 21:00 ` [RFC 0/4] reduce pid_namespace footprint when not configured Eric W. Biederman
2015-09-30 21:34 ` Rasmus Villemoes
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1443646163-31316-4-git-send-email-linux@rasmusvillemoes.dk \
--to=linux@rasmusvillemoes.dk \
--cc=ebiederm@xmission.com \
--cc=linux-kernel@vger.kernel.org \
--cc=oleg@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®