Change some sysctl variables to __read_mostly
Subsystems (5)
PATCH 1/1 Change some sysctl variables to __read_mostly
Change net/core, ipv4 and ipv6 sysctl variables to __read_mostly.
Couldn't actually measure any performance increase while testing (.3% I consider noise), but seems like the right thing to do.
Signed-off-by Brian Haley <[email protected]>
net/core/neighbour.c +1 -1
@@ -2449,7 +2449,7 @@ static struct neigh_sysctl_table {ctl_table neigh_neigh_dir[2 ];ctl_table neigh_proto_dir[2 ];ctl_table neigh_root_dir[2 ]; -} neigh_sysctl_template = { +} neigh_sysctl_template __read_mostly = { .neigh_vars = { { .ctl_name = NET_NEIGH_MCAST_SOLICIT,
net/core/sock.c +5 -5
@@ -187,13 +187,13 @@ static struct lock_class_key af_callback#define SK_RMEM_MAX (_SK_MEM_OVERHEAD * _SK_MEM_PACKETS)/* Run time adjustable parameters. */ -__u32 sysctl_wmem_max =SK_WMEM_MAX ; -__u32 sysctl_rmem_max =SK_RMEM_MAX ; -__u32 sysctl_wmem_default =SK_WMEM_MAX ; -__u32 sysctl_rmem_default =SK_RMEM_MAX ; +__u32 sysctl_wmem_max__read_mostly =SK_WMEM_MAX ; +__u32 sysctl_rmem_max__read_mostly =SK_RMEM_MAX ; +__u32 sysctl_wmem_default__read_mostly =SK_WMEM_MAX ; +__u32 sysctl_rmem_default__read_mostly =SK_RMEM_MAX ;/* Maximal space eaten by iovec or ancilliary data plus some space */ -int sysctl_optmem_max =sizeof (unsigned long )*(2 *UIO_MAXIOV +512 ); +int sysctl_optmem_max__read_mostly =sizeof (unsigned long )*(2 *UIO_MAXIOV +512 );static int sock_set_timeout (long *timeo_p,char __user *optval,int optlen) {
net/ipv4/af_inet.c +2 -2
@@ -392,7 +392,7 @@ int inet_release(struct socket *sock) }/* It is off by default, see below. */ -int sysctl_ip_nonlocal_bind; +int sysctl_ip_nonlocal_bind__read_mostly ;int inet_bind (struct socket *sock,struct sockaddr *uaddr,int addr_len) {
@@ -988,7 +988,7 @@ void inet_unregister_protosw(struct inet* Shall we try to damage output packets if routing dev changes? */ -int sysctl_ip_dynaddr; +int sysctl_ip_dynaddr__read_mostly ;static int inet_sk_reselect_saddr (struct sock *sk) {
net/ipv4/icmp.c +6 -6
@@ -187,11 +187,11 @@ struct icmp_err icmp_err_convert[] = { };/* Control parameters for ECHO replies. */ -int sysctl_icmp_echo_ignore_all; -int sysctl_icmp_echo_ignore_broadcasts =1 ; +int sysctl_icmp_echo_ignore_all__read_mostly ; +int sysctl_icmp_echo_ignore_broadcasts__read_mostly =1 ;/* Control parameter - ignore bogus broadcast responses? */ -int sysctl_icmp_ignore_bogus_error_responses =1 ; +int sysctl_icmp_ignore_bogus_error_responses__read_mostly =1 ;/* * Configurable global rate limit.
@@ -205,9 +205,9 @@ int sysctl_icmp_ignore_bogus_error_respo* time exceeded (11), parameter problem (12) */ -int sysctl_icmp_ratelimit =1 *HZ ; -int sysctl_icmp_ratemask =0x1818 ; -int sysctl_icmp_errors_use_inbound_ifaddr; +int sysctl_icmp_ratelimit__read_mostly =1 *HZ ; +int sysctl_icmp_ratemask__read_mostly =0x1818 ; +int sysctl_icmp_errors_use_inbound_ifaddr__read_mostly ;/* * ICMP control array. This specifies what to do with each ICMP.
net/ipv4/igmp.c +2 -2
@@ -1397,8 +1397,8 @@ static struct in_device * ip_mc_find_dev/* * Join a socket to a group */ -int sysctl_igmp_max_memberships =IP_MAX_MEMBERSHIPS ; -int sysctl_igmp_max_msf =IP_MAX_MSF ; +int sysctl_igmp_max_memberships__read_mostly =IP_MAX_MEMBERSHIPS ; +int sysctl_igmp_max_msf__read_mostly =IP_MAX_MSF ; static int ip_mc_del1_src(struct ip_mc_list *pmc, int sfmode,
net/ipv4/ip_fragment.c +5 -5
@@ -54,15 +54,15 @@* even the most extreme cases without allowing an attacker to measurably * harm machine performance. */ -int sysctl_ipfrag_high_thresh =256 *1024 ; -int sysctl_ipfrag_low_thresh =192 *1024 ; +int sysctl_ipfrag_high_thresh__read_mostly =256 *1024 ; +int sysctl_ipfrag_low_thresh__read_mostly =192 *1024 ; -int sysctl_ipfrag_max_dist =64 ; +int sysctl_ipfrag_max_dist__read_mostly =64 ;/* Important NOTE! Fragment queue must be destroyed before MSL expires. * RFC791 is wrong proposing to prolongate timer each fragment arrival by TTL. */ -int sysctl_ipfrag_time =IP_FRAG_TIME ; +int sysctl_ipfrag_time__read_mostly =IP_FRAG_TIME ;struct ipfrag_skb_cb {
@@ -130,7 +130,7 @@ static unsigned int ipqhashfn(u16 id, u3 }static struct timer_list ipfrag_secret_timer; -int sysctl_ipfrag_secret_interval =10 *60 *HZ ; +int sysctl_ipfrag_secret_interval__read_mostly =10 *60 *HZ ;static void ipfrag_secret_rebuild (unsigned long dummy) {
net/ipv4/ip_output.c +1 -1
@@ -83,7 +83,7 @@#include <linux/netlink.h> #include <linux/tcp.h> -int sysctl_ip_default_ttl =IPDEFTTL ; +int sysctl_ip_default_ttl__read_mostly =IPDEFTTL ;/* Generate a checksum for an outgoing IP datagram. */ __inline__void ip_send_check (struct iphdr *iph)
net/ipv4/tcp.c +1 -1
@@ -268,7 +268,7 @@#include <asm/uaccess.h> #include <asm/ioctls.h> -int sysctl_tcp_fin_timeout =TCP_FIN_TIMEOUT ; +int sysctl_tcp_fin_timeout__read_mostly =TCP_FIN_TIMEOUT ; DEFINE_SNMP_STAT(struct tcp_mib, tcp_statistics) __read_mostly;
net/ipv4/tcp_input.c +17 -17
@@ -72,24 +72,24 @@#include <asm/unaligned.h> #include <net/netdma.h> -int sysctl_tcp_timestamps =1 ; -int sysctl_tcp_window_scaling =1 ; -int sysctl_tcp_sack =1 ; -int sysctl_tcp_fack =1 ; -int sysctl_tcp_reordering =TCP_FASTRETRANS_THRESH ; -int sysctl_tcp_ecn; -int sysctl_tcp_dsack =1 ; -int sysctl_tcp_app_win =31 ; -int sysctl_tcp_adv_win_scale =2 ; - -int sysctl_tcp_stdurg; -int sysctl_tcp_rfc1337; -int sysctl_tcp_max_orphans =NR_FILE ; -int sysctl_tcp_frto; -int sysctl_tcp_nometrics_save; +int sysctl_tcp_timestamps__read_mostly =1 ; +int sysctl_tcp_window_scaling__read_mostly =1 ; +int sysctl_tcp_sack__read_mostly =1 ; +int sysctl_tcp_fack__read_mostly =1 ; +int sysctl_tcp_reordering__read_mostly =TCP_FASTRETRANS_THRESH ; +int sysctl_tcp_ecn__read_mostly ; +int sysctl_tcp_dsack__read_mostly =1 ; +int sysctl_tcp_app_win__read_mostly =31 ; +int sysctl_tcp_adv_win_scale__read_mostly =2 ; + +int sysctl_tcp_stdurg__read_mostly ; +int sysctl_tcp_rfc1337__read_mostly ; +int sysctl_tcp_max_orphans__read_mostly =NR_FILE ; +int sysctl_tcp_frto__read_mostly ; +int sysctl_tcp_nometrics_save__read_mostly ; -int sysctl_tcp_moderate_rcvbuf =1 ; -int sysctl_tcp_abc =1 ; +int sysctl_tcp_moderate_rcvbuf__read_mostly =1 ; +int sysctl_tcp_abc__read_mostly =1 ;#define FLAG_DATA 0x01/* Incoming frame contained data. */ #define FLAG_WIN_UPDATE 0x02/* Incoming ACK was a window update. */
net/ipv4/tcp_ipv4.c +2 -2
@@ -78,8 +78,8 @@#include <linux/proc_fs.h> #include <linux/seq_file.h> -int sysctl_tcp_tw_reuse; -int sysctl_tcp_low_latency; +int sysctl_tcp_tw_reuse__read_mostly ; +int sysctl_tcp_low_latency__read_mostly ;/* Check TCP sequence numbers in ICMP packets. */ #define ICMP_MIN_LENGTH 8
net/ipv4/tcp_minisocks.c +2 -2
@@ -34,8 +34,8 @@#define SYNC_INIT 1#endif -int sysctl_tcp_syncookies =SYNC_INIT ; -int sysctl_tcp_abort_on_overflow; +int sysctl_tcp_syncookies__read_mostly =SYNC_INIT ; +int sysctl_tcp_abort_on_overflow__read_mostly ;struct inet_timewait_death_row tcp_death_row = { .sysctl_max_tw_buckets =NR_FILE *2 ,
net/ipv4/tcp_output.c +6 -6
@@ -43,24 +43,24 @@#include <linux/smp_lock.h> /* People can turn this off for buggy TCP's found in printers etc. */ -int sysctl_tcp_retrans_collapse =1 ; +int sysctl_tcp_retrans_collapse__read_mostly =1 ;/* People can turn this on to work with those rare, broken TCPs that * interpret the window field as a signed quantity. */ -int sysctl_tcp_workaround_signed_windows =0 ; +int sysctl_tcp_workaround_signed_windows__read_mostly =0 ;/* This limits the percentage of the congestion window which we * will allow a single TSO frame to consume. Building TSO frames * which are too large can cause TCP streams to be bursty. */ -int sysctl_tcp_tso_win_divisor =3 ; +int sysctl_tcp_tso_win_divisor__read_mostly =3 ; -int sysctl_tcp_mtu_probing =0 ; -int sysctl_tcp_base_mss =512 ; +int sysctl_tcp_mtu_probing__read_mostly =0 ; +int sysctl_tcp_base_mss__read_mostly =512 ;/* By default, RFC2861 behavior. */ -int sysctl_tcp_slow_start_after_idle =1 ; +int sysctl_tcp_slow_start_after_idle__read_mostly =1 ;static void update_send_head (struct sock *sk,struct tcp_sock *tp,struct sk_buff *skb)
net/ipv4/tcp_timer.c +8 -8
@@ -23,14 +23,14 @@#include <linux/module.h> #include <net/tcp.h> -int sysctl_tcp_syn_retries =TCP_SYN_RETRIES ; -int sysctl_tcp_synack_retries =TCP_SYNACK_RETRIES ; -int sysctl_tcp_keepalive_time =TCP_KEEPALIVE_TIME ; -int sysctl_tcp_keepalive_probes =TCP_KEEPALIVE_PROBES ; -int sysctl_tcp_keepalive_intvl =TCP_KEEPALIVE_INTVL ; -int sysctl_tcp_retries1 =TCP_RETR1 ; -int sysctl_tcp_retries2 =TCP_RETR2 ; -int sysctl_tcp_orphan_retries; +int sysctl_tcp_syn_retries__read_mostly =TCP_SYN_RETRIES ; +int sysctl_tcp_synack_retries__read_mostly =TCP_SYNACK_RETRIES ; +int sysctl_tcp_keepalive_time__read_mostly =TCP_KEEPALIVE_TIME ; +int sysctl_tcp_keepalive_probes__read_mostly =TCP_KEEPALIVE_PROBES ; +int sysctl_tcp_keepalive_intvl__read_mostly =TCP_KEEPALIVE_INTVL ; +int sysctl_tcp_retries1__read_mostly =TCP_RETR1 ; +int sysctl_tcp_retries2__read_mostly =TCP_RETR2 ; +int sysctl_tcp_orphan_retries__read_mostly ;static void tcp_write_timer (unsigned long );static void tcp_delack_timer (unsigned long );
net/ipv6/addrconf.c +3 -3
@@ -145,7 +145,7 @@ static int ipv6_chk_same_addr(const strustatic ATOMIC_NOTIFIER_HEAD (inet6addr_chain); -struct ipv6_devconf ipv6_devconf = { +struct ipv6_devconf ipv6_devconf__read_mostly = { .forwarding =0 , .hop_limit =IPV6_DEFAULT_HOPLIMIT , .mtu6 =IPV6_MIN_MTU ,
@@ -176,7 +176,7 @@ struct ipv6_devconf ipv6_devconf = {#endif }; -static struct ipv6_devconf ipv6_devconf_dflt = { +static struct ipv6_devconf ipv6_devconf_dflt__read_mostly = { .forwarding =0 , .hop_limit =IPV6_DEFAULT_HOPLIMIT , .mtu6 =IPV6_MIN_MTU ,
@@ -3657,7 +3657,7 @@ static struct addrconf_sysctl_tablectl_table addrconf_conf_dir[2 ];ctl_table addrconf_proto_dir[2 ];ctl_table addrconf_root_dir[2 ]; -} addrconf_sysctl = { +} addrconf_sysctl __read_mostly = { .sysctl_header = NULL, .addrconf_vars = { {
net/ipv6/af_inet6.c +1 -1
@@ -67,7 +67,7 @@ MODULE_AUTHOR("Cast of dozens");MODULE_DESCRIPTION ("IPv6 protocol stack for Linux" );MODULE_LICENSE ("GPL" ); -int sysctl_ipv6_bindv6only; +int sysctl_ipv6_bindv6only__read_mostly ;/* The inetsw table contains everything that inet_create needs to * build a new socket.
net/ipv6/icmp.c +1 -1
@@ -151,7 +151,7 @@ static int is_ineligible(struct sk_buffreturn 0 ; } -static int sysctl_icmpv6_time =1 *HZ ; +static int sysctl_icmpv6_time__read_mostly =1 *HZ ;/* * Check the ICMP output rate limit
net/ipv6/mcast.c +1 -1
@@ -171,7 +171,7 @@ static int ip6_mc_leave_src(struct sock#define IPV6_MLD_MAX_MSF 64 -int sysctl_mld_max_msf =IPV6_MLD_MAX_MSF ; +int sysctl_mld_max_msf__read_mostly =IPV6_MLD_MAX_MSF ;/* * socket join on multicast group
net/ipv6/reassembly.c +4 -4
@@ -53,10 +53,10 @@#include <net/ndisc.h> #include <net/addrconf.h> -int sysctl_ip6frag_high_thresh =256 *1024 ; -int sysctl_ip6frag_low_thresh =192 *1024 ; +int sysctl_ip6frag_high_thresh__read_mostly =256 *1024 ; +int sysctl_ip6frag_low_thresh__read_mostly =192 *1024 ; -int sysctl_ip6frag_time =IPV6_FRAG_TIMEOUT ; +int sysctl_ip6frag_time__read_mostly =IPV6_FRAG_TIMEOUT ;struct ip6frag_skb_cb {
@@ -152,7 +152,7 @@ static unsigned int ip6qhashfn(u32 id, s }static struct timer_list ip6_frag_secret_timer; -int sysctl_ip6frag_secret_interval =10 *60 *HZ ; +int sysctl_ip6frag_secret_interval__read_mostly =10 *60 *HZ ;static void ip6_frag_secret_rebuild (unsigned long dummy) {
From: Brian Haley <[email protected]>
Date: Wed, 09 Aug 2006 11:09:02 -0400
Quoted 6 lines
Change net/core, ipv4 and ipv6 sysctl variables to
__read_mostly.Couldn't actually measure any performance increase while testing (.3% I consider noise), but seems like the right thing to do.
Signed-off-by Brian Haley <[email protected]>
Applied, thanks a lot Brian.