From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932901AbbI3Uu5 (ORCPT ); Wed, 30 Sep 2015 16:50:57 -0400 Received: from mail-la0-f45.google.com ([209.85.215.45]:34581 "EHLO mail-la0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932909AbbI3Utv (ORCPT ); Wed, 30 Sep 2015 16:49:51 -0400 From: Rasmus Villemoes To: "Eric W. Biederman" , Oleg Nesterov Cc: Rasmus Villemoes , 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 Message-Id: <1443646163-31316-4-git-send-email-linux@rasmusvillemoes.dk> X-Mailer: git-send-email 2.1.3 In-Reply-To: <1443646163-31316-1-git-send-email-linux@rasmusvillemoes.dk> References: <1443646163-31316-1-git-send-email-linux@rasmusvillemoes.dk> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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