Skip to content

Commit 022cbae

Browse files
dlunevdavem330
authored andcommitted
[NET]: Move unneeded data to initdata section.
This patch reverts Eric's commit 2b008b0 It diets .text & .data section of the kernel if CONFIG_NET_NS is not set. This is safe after list operations cleanup. Signed-of-by: Denis V. Lunev <den@openvz.org> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent ed160e8 commit 022cbae

6 files changed

Lines changed: 9 additions & 7 deletions

File tree

‎drivers/net/loopback.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ static __net_exit void loopback_net_exit(struct net *net)
284284
unregister_netdev(dev);
285285
}
286286

287-
static struct pernet_operations loopback_net_ops = {
287+
static struct pernet_operations __net_initdata loopback_net_ops = {
288288
.init = loopback_net_init,
289289
.exit = loopback_net_exit,
290290
};

‎fs/proc/proc_net.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ static __net_exit void proc_net_ns_exit(struct net *net)
178178
kfree(net->proc_net_root);
179179
}
180180

181-
static struct pernet_operations proc_net_ns_ops = {
181+
static struct pernet_operations __net_initdata proc_net_ns_ops = {
182182
.init = proc_net_ns_init,
183183
.exit = proc_net_ns_exit,
184184
};

‎include/net/net_namespace.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,11 @@ static inline struct net *maybe_get_net(struct net *net)
119119
#ifdef CONFIG_NET_NS
120120
#define __net_init
121121
#define __net_exit
122+
#define __net_initdata
122123
#else
123124
#define __net_init __init
124125
#define __net_exit __exit_refok
126+
#define __net_initdata __initdata
125127
#endif
126128

127129
struct pernet_operations {

‎net/core/dev.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2688,7 +2688,7 @@ static void __net_exit dev_proc_net_exit(struct net *net)
26882688
proc_net_remove(net, "dev");
26892689
}
26902690

2691-
static struct pernet_operations dev_proc_ops = {
2691+
static struct pernet_operations __net_initdata dev_proc_ops = {
26922692
.init = dev_proc_net_init,
26932693
.exit = dev_proc_net_exit,
26942694
};
@@ -4353,7 +4353,7 @@ static void __net_exit netdev_exit(struct net *net)
43534353
kfree(net->dev_index_head);
43544354
}
43554355

4356-
static struct pernet_operations netdev_net_ops = {
4356+
static struct pernet_operations __net_initdata netdev_net_ops = {
43574357
.init = netdev_init,
43584358
.exit = netdev_exit,
43594359
};
@@ -4384,7 +4384,7 @@ static void __net_exit default_device_exit(struct net *net)
43844384
rtnl_unlock();
43854385
}
43864386

4387-
static struct pernet_operations default_device_ops = {
4387+
static struct pernet_operations __net_initdata default_device_ops = {
43884388
.exit = default_device_exit,
43894389
};
43904390

‎net/core/dev_mcast.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ static void __net_exit dev_mc_net_exit(struct net *net)
285285
proc_net_remove(net, "dev_mcast");
286286
}
287287

288-
static struct pernet_operations dev_mc_net_ops = {
288+
static struct pernet_operations __net_initdata dev_mc_net_ops = {
289289
.init = dev_mc_net_init,
290290
.exit = dev_mc_net_exit,
291291
};

‎net/netlink/af_netlink.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1888,7 +1888,7 @@ static void __net_exit netlink_net_exit(struct net *net)
18881888
#endif
18891889
}
18901890

1891-
static struct pernet_operations netlink_net_ops = {
1891+
static struct pernet_operations __net_initdata netlink_net_ops = {
18921892
.init = netlink_net_init,
18931893
.exit = netlink_net_exit,
18941894
};

0 commit comments

Comments
 (0)