lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 14 Apr 2015 14:25:11 +0200
From:	Denys Vlasenko <dvlasenk@...hat.com>
To:	"David S. Miller" <davem@...emloft.net>
Cc:	Denys Vlasenko <dvlasenk@...hat.com>,
	"Eric W. Biederman" <ebiederm@...ssion.com>,
	Jan Engelhardt <jengelh@...ozas.de>,
	Jiri Pirko <jpirko@...hat.com>, linux-kernel@...r.kernel.org,
	netdev@...r.kernel.org
Subject: [PATCH] netns: deinline net_generic()

On x86 allyesconfig build:
The function compiles to 130 bytes of machine code.
It has 493 callsites.
Total reduction of vmlinux size: 27906 bytes.

   text	     data      bss       dec     hex filename
82447071 22255384 20627456 125329911 77861f7 vmlinux4
82419165 22255384 20627456 125302005 777f4f5 vmlinux5

Signed-off-by: Denys Vlasenko <dvlasenk@...hat.com>
CC: Eric W. Biederman <ebiederm@...ssion.com>
CC: David S. Miller <davem@...emloft.net>
CC: Jan Engelhardt <jengelh@...ozas.de>
CC: Jiri Pirko <jpirko@...hat.com>
CC: linux-kernel@...r.kernel.org
CC: netdev@...r.kernel.org
---
 include/net/netns/generic.h | 15 +--------------
 net/core/net_namespace.c    | 16 ++++++++++++++++
 2 files changed, 17 insertions(+), 14 deletions(-)

diff --git a/include/net/netns/generic.h b/include/net/netns/generic.h
index 0931618..61a33bf 100644
--- a/include/net/netns/generic.h
+++ b/include/net/netns/generic.h
@@ -31,18 +31,5 @@ struct net_generic {
 	void *ptr[0];
 };
 
-static inline void *net_generic(const struct net *net, int id)
-{
-	struct net_generic *ng;
-	void *ptr;
-
-	rcu_read_lock();
-	ng = rcu_dereference(net->gen);
-	BUG_ON(id == 0 || id > ng->len);
-	ptr = ng->ptr[id - 1];
-	rcu_read_unlock();
-
-	BUG_ON(!ptr);
-	return ptr;
-}
+void *net_generic(const struct net *net, int id);
 #endif
diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c
index cb5290b..66c9ba1 100644
--- a/net/core/net_namespace.c
+++ b/net/core/net_namespace.c
@@ -42,6 +42,22 @@ EXPORT_SYMBOL(init_net);
 
 static unsigned int max_gen_ptrs = INITIAL_NET_GEN_PTRS;
 
+void *net_generic(const struct net *net, int id)
+{
+	struct net_generic *ng;
+	void *ptr;
+
+	rcu_read_lock();
+	ng = rcu_dereference(net->gen);
+	BUG_ON(id == 0 || id > ng->len);
+	ptr = ng->ptr[id - 1];
+	rcu_read_unlock();
+
+	BUG_ON(!ptr);
+	return ptr;
+}
+EXPORT_SYMBOL(net_generic);
+
 static struct net_generic *net_alloc_generic(void)
 {
 	struct net_generic *ng;
-- 
1.8.1.4

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

Powered by blists - more mailing lists