* [PATCH net-next] net: mark some potential candidates __read_mostly
@ 2015-01-29 11:15 Daniel Borkmann
2015-01-29 15:40 ` Hannes Frederic Sowa
2015-01-31 1:58 ` David Miller
0 siblings, 2 replies; 4+ messages in thread
From: Daniel Borkmann @ 2015-01-29 11:15 UTC (permalink / raw)
To: davem; +Cc: netdev
They are all either written once or extremly rarely (e.g. from init
code), so we can move them to the .data..read_mostly section.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
---
drivers/net/ipvlan/ipvlan_core.c | 2 +-
net/bridge/br_netlink.c | 2 +-
net/ipv4/devinet.c | 2 +-
net/ipv6/addrconf.c | 2 +-
net/mpls/mpls_gso.c | 4 ++--
5 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/net/ipvlan/ipvlan_core.c b/drivers/net/ipvlan/ipvlan_core.c
index 2e19528..2a17500 100644
--- a/drivers/net/ipvlan/ipvlan_core.c
+++ b/drivers/net/ipvlan/ipvlan_core.c
@@ -9,7 +9,7 @@
#include "ipvlan.h"
-static u32 ipvlan_jhash_secret;
+static u32 ipvlan_jhash_secret __read_mostly;
void ipvlan_init_secret(void)
{
diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c
index 3875ea5..e08b260 100644
--- a/net/bridge/br_netlink.c
+++ b/net/bridge/br_netlink.c
@@ -701,7 +701,7 @@ static size_t br_get_link_af_size(const struct net_device *dev)
return pv->num_vlans * nla_total_size(sizeof(struct bridge_vlan_info));
}
-static struct rtnl_af_ops br_af_ops = {
+static struct rtnl_af_ops br_af_ops __read_mostly = {
.family = AF_BRIDGE,
.get_link_af_size = br_get_link_af_size,
};
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index 59ebe16..f0b4a31 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -2322,7 +2322,7 @@ static __net_initdata struct pernet_operations devinet_ops = {
.exit = devinet_exit_net,
};
-static struct rtnl_af_ops inet_af_ops = {
+static struct rtnl_af_ops inet_af_ops __read_mostly = {
.family = AF_INET,
.fill_link_af = inet_fill_link_af,
.get_link_af_size = inet_get_link_af_size,
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 7dcc065e..8623118 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -5405,7 +5405,7 @@ static struct pernet_operations addrconf_ops = {
.exit = addrconf_exit_net,
};
-static struct rtnl_af_ops inet6_ops = {
+static struct rtnl_af_ops inet6_ops __read_mostly = {
.family = AF_INET6,
.fill_link_af = inet6_fill_link_af,
.get_link_af_size = inet6_get_link_af_size,
diff --git a/net/mpls/mpls_gso.c b/net/mpls/mpls_gso.c
index 349295d..809df53 100644
--- a/net/mpls/mpls_gso.c
+++ b/net/mpls/mpls_gso.c
@@ -60,14 +60,14 @@ out:
return segs;
}
-static struct packet_offload mpls_mc_offload = {
+static struct packet_offload mpls_mc_offload __read_mostly = {
.type = cpu_to_be16(ETH_P_MPLS_MC),
.callbacks = {
.gso_segment = mpls_gso_segment,
},
};
-static struct packet_offload mpls_uc_offload = {
+static struct packet_offload mpls_uc_offload __read_mostly = {
.type = cpu_to_be16(ETH_P_MPLS_UC),
.callbacks = {
.gso_segment = mpls_gso_segment,
--
1.7.11.7
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH net-next] net: mark some potential candidates __read_mostly
2015-01-29 11:15 [PATCH net-next] net: mark some potential candidates __read_mostly Daniel Borkmann
@ 2015-01-29 15:40 ` Hannes Frederic Sowa
2015-01-29 16:11 ` Daniel Borkmann
2015-01-31 1:58 ` David Miller
1 sibling, 1 reply; 4+ messages in thread
From: Hannes Frederic Sowa @ 2015-01-29 15:40 UTC (permalink / raw)
To: Daniel Borkmann; +Cc: davem, netdev
On Do, 2015-01-29 at 12:15 +0100, Daniel Borkmann wrote:
> They are all either written once or extremly rarely (e.g. from init
> code), so we can move them to the .data..read_mostly section.
>
> Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
> ---
> drivers/net/ipvlan/ipvlan_core.c | 2 +-
> net/bridge/br_netlink.c | 2 +-
> net/ipv4/devinet.c | 2 +-
> net/ipv6/addrconf.c | 2 +-
> net/mpls/mpls_gso.c | 4 ++--
> 5 files changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/net/ipvlan/ipvlan_core.c b/drivers/net/ipvlan/ipvlan_core.c
> index 2e19528..2a17500 100644
> --- a/drivers/net/ipvlan/ipvlan_core.c
> +++ b/drivers/net/ipvlan/ipvlan_core.c
> @@ -9,7 +9,7 @@
>
> #include "ipvlan.h"
>
> -static u32 ipvlan_jhash_secret;
> +static u32 ipvlan_jhash_secret __read_mostly;
>
> void ipvlan_init_secret(void)
> {
> diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c
> index 3875ea5..e08b260 100644
> --- a/net/bridge/br_netlink.c
> +++ b/net/bridge/br_netlink.c
> @@ -701,7 +701,7 @@ static size_t br_get_link_af_size(const struct net_device *dev)
> return pv->num_vlans * nla_total_size(sizeof(struct bridge_vlan_info));
> }
>
> -static struct rtnl_af_ops br_af_ops = {
> +static struct rtnl_af_ops br_af_ops __read_mostly = {
> .family = AF_BRIDGE,
> .get_link_af_size = br_get_link_af_size,
> };
Why not const?
> diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
> index 59ebe16..f0b4a31 100644
> --- a/net/ipv4/devinet.c
> +++ b/net/ipv4/devinet.c
> @@ -2322,7 +2322,7 @@ static __net_initdata struct pernet_operations devinet_ops = {
> .exit = devinet_exit_net,
> };
>
> -static struct rtnl_af_ops inet_af_ops = {
> +static struct rtnl_af_ops inet_af_ops __read_mostly = {
> .family = AF_INET,
> .fill_link_af = inet_fill_link_af,
> .get_link_af_size = inet_get_link_af_size,
Const?
> diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
> index 7dcc065e..8623118 100644
> --- a/net/ipv6/addrconf.c
> +++ b/net/ipv6/addrconf.c
> @@ -5405,7 +5405,7 @@ static struct pernet_operations addrconf_ops = {
> .exit = addrconf_exit_net,
> };
>
> -static struct rtnl_af_ops inet6_ops = {
> +static struct rtnl_af_ops inet6_ops __read_mostly = {
> .family = AF_INET6,
> .fill_link_af = inet6_fill_link_af,
> .get_link_af_size = inet6_get_link_af_size,
Const?
> diff --git a/net/mpls/mpls_gso.c b/net/mpls/mpls_gso.c
> index 349295d..809df53 100644
> --- a/net/mpls/mpls_gso.c
> +++ b/net/mpls/mpls_gso.c
> @@ -60,14 +60,14 @@ out:
> return segs;
> }
>
> -static struct packet_offload mpls_mc_offload = {
> +static struct packet_offload mpls_mc_offload __read_mostly = {
> .type = cpu_to_be16(ETH_P_MPLS_MC),
> .callbacks = {
> .gso_segment = mpls_gso_segment,
> },
> };
>
> -static struct packet_offload mpls_uc_offload = {
> +static struct packet_offload mpls_uc_offload __read_mostly = {
> .type = cpu_to_be16(ETH_P_MPLS_UC),
> .callbacks = {
> .gso_segment = mpls_gso_segment,
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net-next] net: mark some potential candidates __read_mostly
2015-01-29 15:40 ` Hannes Frederic Sowa
@ 2015-01-29 16:11 ` Daniel Borkmann
0 siblings, 0 replies; 4+ messages in thread
From: Daniel Borkmann @ 2015-01-29 16:11 UTC (permalink / raw)
To: Hannes Frederic Sowa; +Cc: davem, netdev
On 01/29/2015 04:40 PM, Hannes Frederic Sowa wrote:
...
> Why not const?
Because all these candidates have a list member and are being
registered at respective places during __init/__exit. Similar
structs in other places already have __read_mostly, but these
ones can still be converted to it.
Cheers,
Daniel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net-next] net: mark some potential candidates __read_mostly
2015-01-29 11:15 [PATCH net-next] net: mark some potential candidates __read_mostly Daniel Borkmann
2015-01-29 15:40 ` Hannes Frederic Sowa
@ 2015-01-31 1:58 ` David Miller
1 sibling, 0 replies; 4+ messages in thread
From: David Miller @ 2015-01-31 1:58 UTC (permalink / raw)
To: dborkman; +Cc: netdev
From: Daniel Borkmann <dborkman@redhat.com>
Date: Thu, 29 Jan 2015 12:15:03 +0100
> They are all either written once or extremly rarely (e.g. from init
> code), so we can move them to the .data..read_mostly section.
>
> Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
Applied, thanks Daniel.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-01-31 1:58 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-29 11:15 [PATCH net-next] net: mark some potential candidates __read_mostly Daniel Borkmann
2015-01-29 15:40 ` Hannes Frederic Sowa
2015-01-29 16:11 ` Daniel Borkmann
2015-01-31 1:58 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).