: Move some initialization code into __init section.
Subsystems (3)
PATCH 2/2 : Move some initialization code into __init section.
Everything that is called from netlbl_init() can be marked with __init. This moves 620 bytes from .text section to .text.init one.
--- net/netlabel/netlabel_cipso_v4.c | 2 +- net/netlabel/netlabel_domainhash.c | 2 +- net/netlabel/netlabel_mgmt.c | 2 +- net/netlabel/netlabel_unlabeled.c | 6 +++--- net/netlabel/netlabel_user.c | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-)
net/netlabel/netlabel_cipso_v4.c +1 -1
@@ -761,7 +761,7 @@ static struct genl_ops netlbl_cipsov4_ops[] = {* mechanism. Returns zero on success, negative values on failure. * */ -int netlbl_cipsov4_genl_init (void ) +int __init netlbl_cipsov4_genl_init (void ) {int ret_val, i;
net/netlabel/netlabel_domainhash.c +1 -1
@@ -171,7 +171,7 @@ static struct netlbl_dom_map *netlbl_domhsh_search_def(const char *domain)* values on error. * */ -int netlbl_domhsh_init (u32 size) +int __init netlbl_domhsh_init (u32 size) {u32 iter;struct netlbl_domhsh_tbl *hsh_tbl;
net/netlabel/netlabel_mgmt.c +1 -1
@@ -588,7 +588,7 @@ static struct genl_ops netlbl_mgmt_genl_ops[] = {* mechanism. Returns zero on success, negative values on failure. * */ -int netlbl_mgmt_genl_init (void ) +int __init netlbl_mgmt_genl_init (void ) {int ret_val, i;
net/netlabel/netlabel_unlabeled.c +3 -3
@@ -1624,7 +1624,7 @@ static struct genl_ops netlbl_unlabel_genl_ops[] = {* mechanism. Returns zero on success, negative values on failure. * */ -int netlbl_unlabel_genl_init (void ) +int __init netlbl_unlabel_genl_init (void ) {int ret_val, i;
@@ -1661,7 +1661,7 @@ static struct notifier_block netlbl_unlhsh_netdev_notifier = {* non-zero values on error. * */ -int netlbl_unlabel_init (u32 size) +int __init netlbl_unlabel_init (u32 size) {u32 iter;struct netlbl_unlhsh_tbl *hsh_tbl;
@@ -1765,7 +1765,7 @@ unlabel_getattr_nolabel:* and to send unlabeled network traffic by default. * */ -int netlbl_unlabel_defconf (void ) +int __init netlbl_unlabel_defconf (void ) {int ret_val;struct netlbl_dom_map *entry;
net/netlabel/netlabel_user.c +1 -1
@@ -59,7 +59,7 @@* non-zero on failure. * */ -int netlbl_netlink_init (void ) +int __init netlbl_netlink_init (void ) {int ret_val;
Signature · 1 line
1.5.3.4
Quoted 4 lines · Pavel Emelyanov
Everything that is called from
netlbl_init()can be marked with__init. This moves 620 bytes from .text section to .text.init one.Signed-off-by Pavel Emelyanov <[email protected]>
I ran into problems with __init and __exit once because I didn't fully understand their impact; this caused me to be rather hesitant to make use of them. However, you seem to know what you are doing and these look like reasonable changes to me so I'll ack this patch and if we do run into a problem the fix should be pretty trivial.
I appreciate you taking the time to find these optimizations, thanks again.
Quoted 90 lines
--- net/netlabel/netlabel_cipso_v4.c | 2 +- net/netlabel/netlabel_domainhash.c | 2 +- net/netlabel/netlabel_mgmt.c | 2 +- net/netlabel/netlabel_unlabeled.c | 6 +++--- net/netlabel/netlabel_user.c | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-)(quoted diff) +0
-0
b/net/netlabel/netlabel_cipso_v4.cindex 283ff4a..fdc14a0 100644net/netlabel/netlabel_cipso_v4.c +1
-1@@ -761,7 +761,7 @@ static struct genl_ops netlbl_cipsov4_ops[] = {* mechanism. Returns zero on success, negative values on failure. * */ -int netlbl_cipsov4_genl_init (void ) +int __init netlbl_cipsov4_genl_init (void ) {int ret_val, i;(quoted diff) +0
-0
b/net/netlabel/netlabel_domainhash.cindex fd46231..02c2f7c 100644net/netlabel/netlabel_domainhash.c +1
-1@@ -171,7 +171,7 @@ static struct netlbl_dom_map*netlbl_domhsh_search_def(const char *domain) * values on error. * */ -int netlbl_domhsh_init (u32 size) +int __init netlbl_domhsh_init (u32 size) {u32 iter;struct netlbl_domhsh_tbl *hsh_tbl;net/netlabel/netlabel_mgmt.c +1
-1@@ -588,7 +588,7 @@ static struct genl_ops netlbl_mgmt_genl_ops[] = {* mechanism. Returns zero on success, negative values on failure. * */ -int netlbl_mgmt_genl_init (void ) +int __init netlbl_mgmt_genl_init (void ) {int ret_val, i;(quoted diff) +0
-0
b/net/netlabel/netlabel_unlabeled.cindex f0f1322..4478f2f 100644net/netlabel/netlabel_unlabeled.c +1
-1@@ -1624,7 +1624,7 @@ static struct genl_ops netlbl_unlabel_genl_ops[] = {* mechanism. Returns zero on success, negative values on failure. * */ -int netlbl_unlabel_genl_init (void ) +int __init netlbl_unlabel_genl_init (void ) {int ret_val, i;@@ -1661,7 +1661,7 @@ static struct notifier_block
netlbl_unlhsh_netdev_notifier= { * non-zero values on error.
*
*/net/netlabel/netlabel_unlabeled.c +2
-2-int netlbl_unlabel_init (u32 size) +int __init netlbl_unlabel_init (u32 size) {u32 iter;struct netlbl_unlhsh_tbl *hsh_tbl;@@ -1765,7 +1765,7 @@ unlabel_getattr_nolabel:* and to send unlabeled network traffic by default. * */ -int netlbl_unlabel_defconf (void ) +int __init netlbl_unlabel_defconf (void ) {int ret_val;struct netlbl_dom_map *entry;net/netlabel/netlabel_user.c +1
-1@@ -59,7 +59,7 @@* non-zero on failure. * */ -int netlbl_netlink_init (void ) +int __init netlbl_netlink_init (void ) {int ret_val;
Signature · 2 lines
paul moore linux security @ hp
From: Paul Moore <[email protected]>
Date: Wed, 13 Feb 2008 08:37:16 -0500
Quoted 11 lines · Pavel Emelyanov
Quoted 4 lines
Everything that is called from
netlbl_init()can be marked with__init. This moves 620 bytes from .text section to .text.init one.Signed-off-by Pavel Emelyanov <[email protected]>I ran into problems with
__initand__exitonce because I didn't fully understand their impact; this caused me to be rather hesitant to make use of them. However, you seem to know what you are doing and these look like reasonable changes to me so I'll ack this patch and if we do run into a problem the fix should be pretty trivial.
Yes, this stuff can be non-trivial at best on some days :-)
Quoted 3 lines
I appreciate you taking the time to find these optimizations, thanks again.
Acked-by Paul Moore <[email protected]>
Applied.