From: Simon Horman <horms@verge.net.au> Date: 2011-03-14 03:45:26
I am posting this series for review. In particular of patches 3 & 4 in the
series, whose previous versions received some feedback from Eric. And
patches 5 & 6 which are new.
The first 6 patches are fixes from Julian Anastasov.
They can be found in git at
git://git.kernel.org/pub/scm/linux/kernel/git/horms/lvs-test-2.6.git ja2
The remaining patches are from myself to conditionally include sysctl
support. They have been posted several times and only haven't been merged
as there are some minor conflicts with Julian's changes.
They, along with Julian's changes, can be found in git at
git://git.kernel.org/pub/scm/linux/kernel/git/horms/lvs-test-2.6.git config-sysctl2
Julian Anastasov (6):
ipvs: move struct netns_ipvs
ipvs: reorganize tot_stats
ipvs: properly zero stats and rates
ipvs: remove unused seqcount stats
ipvs: optimize rates reading
ipvs: rename estimator functions
Simon Horman (14):
IPVS: Add ip_vs_route_me_harder()
IPVS: Add sysctl_snat_reroute()
IPVS: Add sysctl_nat_icmp_send()
IPVS: Add {sysctl_sync_threshold,period}()
IPVS: Add sysctl_sync_ver()
IPVS: Add sysctl_expire_nodest_conn()
IPVS: Add expire_quiescent_template()
IPVS: Conditinally use sysctl_lblc{r}_expiration
IPVS: ip_vs_todrop() becomes a noop when CONFIG_SYSCTL is undefined
IPVS: Conditional ip_vs_conntrack_enabled()
IPVS: Minimise ip_vs_leave when CONFIG_SYSCTL is undefined
IPVS: Conditionally define and use ip_vs_lblc{r}_table
IPVS: Add __ip_vs_control_{init,cleanup}_sysctl()
IPVS: Conditionally include sysctl members of struct netns_ipvs
include/net/ip_vs.h | 196 +++++++++++++++++++++++++++---
include/net/net_namespace.h | 2 +-
include/net/netns/ip_vs.h | 143 ----------------------
net/netfilter/ipvs/ip_vs_conn.c | 13 ++-
net/netfilter/ipvs/ip_vs_core.c | 104 ++++++++++------
net/netfilter/ipvs/ip_vs_ctl.c | 248 ++++++++++++++++++++++---------------
net/netfilter/ipvs/ip_vs_est.c | 55 ++++-----
net/netfilter/ipvs/ip_vs_lblc.c | 31 ++++--
net/netfilter/ipvs/ip_vs_lblcr.c | 35 ++++--
net/netfilter/ipvs/ip_vs_sync.c | 8 +-
10 files changed, 477 insertions(+), 358 deletions(-)
delete mode 100644 include/net/netns/ip_vs.h
From: Simon Horman <horms@verge.net.au> Date: 2011-03-14 03:45:27
From: Julian Anastasov <ja@ssi.bg>
Remove include/net/netns/ip_vs.h because it depends on
structures from include/net/ip_vs.h. As ipvs is pointer in
struct net it is better to move struct netns_ipvs into
include/net/ip_vs.h, so that we can easily use other structures
in struct netns_ipvs.
Signed-off-by: Julian Anastasov <ja@ssi.bg>
Signed-off-by: Simon Horman <horms@verge.net.au>
---
include/net/ip_vs.h | 122 ++++++++++++++++++++++++++++++++++++
include/net/net_namespace.h | 2 +-
include/net/netns/ip_vs.h | 143 -------------------------------------------
3 files changed, 123 insertions(+), 144 deletions(-)
delete mode 100644 include/net/netns/ip_vs.h
From: Simon Horman <horms@verge.net.au> Date: 2011-03-14 03:45:28
From: Julian Anastasov <ja@ssi.bg>
The global tot_stats contains cpustats field just like the
stats for dest and svc, so better use it to simplify the usage
in estimation_timer. As tot_stats is registered as estimator
we can remove the special ip_vs_read_cpu_stats call for
tot_stats. Fix ip_vs_read_cpu_stats to be called under
stats lock because it is still used as synchronization between
estimation timer and user context (the stats readers).
Also, make sure ip_vs_stats_percpu_show reads properly
the u64 stats from user context.
Signed-off-by: Julian Anastasov <ja@ssi.bg>
Signed-off-by: Simon Horman <horms@verge.net.au>
---
include/net/ip_vs.h | 3 +-
net/netfilter/ipvs/ip_vs_core.c | 6 ++--
net/netfilter/ipvs/ip_vs_ctl.c | 45 ++++++++++++++++++++------------------
net/netfilter/ipvs/ip_vs_est.c | 3 +-
4 files changed, 29 insertions(+), 28 deletions(-)
@@ -1481,7 +1481,7 @@ static int ip_vs_zero_all(struct net *net)}}-ip_vs_zero_stats(net_ipvs(net)->tot_stats);+ip_vs_zero_stats(&net_ipvs(net)->tot_stats);return0;}
@@ -3505,17 +3515,12 @@ int __net_init __ip_vs_control_init(struct net *net)atomic_set(&ipvs->nullsvc_counter,0);/* procfs stats */-ipvs->tot_stats=kzalloc(sizeof(structip_vs_stats),GFP_KERNEL);-if(ipvs->tot_stats==NULL){-pr_err("%s(): no memory.\n",__func__);-return-ENOMEM;-}-ipvs->cpustats=alloc_percpu(structip_vs_cpu_stats);-if(!ipvs->cpustats){+ipvs->tot_stats.cpustats=alloc_percpu(structip_vs_cpu_stats);+if(!ipvs->tot_stats.cpustats){pr_err("%s() alloc_percpu failed\n",__func__);gotoerr_alloc;}-spin_lock_init(&ipvs->tot_stats->lock);+spin_lock_init(&ipvs->tot_stats.lock);proc_net_fops_create(net,"ip_vs",0,&ip_vs_info_fops);proc_net_fops_create(net,"ip_vs_stats",0,&ip_vs_stats_fops);
@@ -3563,7 +3568,7 @@ int __net_init __ip_vs_control_init(struct net *net)gotoerr_dup;}#endif-ip_vs_new_estimator(net,ipvs->tot_stats);+ip_vs_new_estimator(net,&ipvs->tot_stats);ipvs->sysctl_tbl=tbl;/* Schedule defense work */INIT_DELAYED_WORK(&ipvs->defense_work,defense_work_handler);
@@ -3571,9 +3576,8 @@ int __net_init __ip_vs_control_init(struct net *net)return0;err_dup:-free_percpu(ipvs->cpustats);+free_percpu(ipvs->tot_stats.cpustats);err_alloc:-kfree(ipvs->tot_stats);return-ENOMEM;}
From: Simon Horman <horms@verge.net.au> Date: 2011-03-14 03:45:29
From: Julian Anastasov <ja@ssi.bg>
Currently, the new percpu counters are not zeroed and
the zero commands do not work as expected, we still show the old
sum of percpu values. OTOH, we can not reset the percpu counters
from user context without causing the incrementing to use old
and bogus values.
So, as Eric Dumazet suggested fix that by moving all overhead
to stats reading in user context. Do not introduce overhead in
timer context (estimator) and incrementing (packet handling in
softirqs).
The new ustats0 field holds the zero point for all
counter values, the rates always use 0 as base value as before.
When showing the values to user space just give the difference
between counters and the base values. The only drawback is that
percpu stats are not zeroed, they are accessible only from /proc
and are new interface, so it should not be a compatibility problem
as long as the sum stats are correct after zeroing.
Signed-off-by: Julian Anastasov <ja@ssi.bg>
Signed-off-by: Simon Horman <horms@verge.net.au>
---
include/net/ip_vs.h | 1 +
net/netfilter/ipvs/ip_vs_ctl.c | 96 +++++++++++++++++++++++++---------------
net/netfilter/ipvs/ip_vs_est.c | 15 +++---
3 files changed, 69 insertions(+), 43 deletions(-)
@@ -184,13 +184,14 @@ void ip_vs_kill_estimator(struct net *net, struct ip_vs_stats *stats)voidip_vs_zero_estimator(structip_vs_stats*stats){structip_vs_estimator*est=&stats->est;--/* set counters zero, caller must hold the stats->lock lock */-est->last_inbytes=0;-est->last_outbytes=0;-est->last_conns=0;-est->last_inpkts=0;-est->last_outpkts=0;+structip_vs_stats_user*u=&stats->ustats;++/* reset counters, caller must hold the stats->lock lock */+est->last_inbytes=u->inbytes;+est->last_outbytes=u->outbytes;+est->last_conns=u->conns;+est->last_inpkts=u->inpkts;+est->last_outpkts=u->outpkts;est->cps=0;est->inpps=0;est->outpps=0;
From: Simon Horman <horms@verge.net.au> Date: 2011-03-14 03:45:30
From: Julian Anastasov <ja@ssi.bg>
Remove ustats_seq, IPVS_STAT_INC and IPVS_STAT_ADD
because they are not used. They were replaced with u64_stats.
Signed-off-by: Julian Anastasov <ja@ssi.bg>
Signed-off-by: Simon Horman <horms@verge.net.au>
---
include/net/ip_vs.h | 17 -----------------
1 files changed, 0 insertions(+), 17 deletions(-)
From: Simon Horman <horms@verge.net.au> Date: 2011-03-14 03:45:31
From: Julian Anastasov <ja@ssi.bg>
Move the estimator reading from estimation_timer to user
context. ip_vs_read_estimator() will be used to decode the rate
values. As the decoded rates are not set by estimation timer
there is no need to reset them in ip_vs_zero_stats.
There is no need ip_vs_new_estimator() to encode stats
to rates, if the destination is in trash both the stats and the
rates are inactive.
Signed-off-by: Julian Anastasov <ja@ssi.bg>
Signed-off-by: Simon Horman <horms@verge.net.au>
---
include/net/ip_vs.h | 2 ++
net/netfilter/ipvs/ip_vs_ctl.c | 31 ++++++++++++-------------------
net/netfilter/ipvs/ip_vs_est.c | 33 +++++++++++++--------------------
3 files changed, 27 insertions(+), 39 deletions(-)
@@ -742,7 +737,6 @@ ip_vs_zero_stats(struct ip_vs_stats *stats)/* get current counters as zero point, rates are zeroed */#define IP_VS_ZERO_STATS_COUNTER(c) stats->ustats0.c = stats->ustats.c-#define IP_VS_ZERO_STATS_RATE(r) stats->ustats.r = 0IP_VS_ZERO_STATS_COUNTER(conns);IP_VS_ZERO_STATS_COUNTER(inpkts);
@@ -1201,7 +1201,7 @@ ip_vs_add_service(struct net *net, struct ip_vs_service_user_kern *u,elseif(svc->port==0)atomic_inc(&ipvs->nullsvc_counter);-ip_vs_new_estimator(net,&svc->stats);+ip_vs_start_estimator(net,&svc->stats);/* Count only IPv4 services for old get/setsockopt interface */if(svc->af==AF_INET)
@@ -3585,7 +3585,7 @@ int __net_init __ip_vs_control_init(struct net *net)gotoerr_dup;}#endif-ip_vs_new_estimator(net,&ipvs->tot_stats);+ip_vs_start_estimator(net,&ipvs->tot_stats);ipvs->sysctl_tbl=tbl;/* Schedule defense work */INIT_DELAYED_WORK(&ipvs->defense_work,defense_work_handler);
@@ -737,7 +755,6 @@ static int handle_response_icmp(int af, struct sk_buff *skb,structip_vs_protocol*pp,unsignedintoffset,unsignedintihl){-structnetns_ipvs*ipvs;unsignedintverdict=NF_DROP;if(IP_VS_FWD_METHOD(cp)!=0){
@@ -759,8 +776,6 @@ static int handle_response_icmp(int af, struct sk_buff *skb,if(!skb_make_writable(skb,offset))gotoout;-ipvs=net_ipvs(skb_net(skb));-#ifdef CONFIG_IP_VS_IPV6if(af==AF_INET6)ip_vs_nat_icmp_v6(skb,pp,cp,1);
@@ -768,16 +783,8 @@ static int handle_response_icmp(int af, struct sk_buff *skb,#endifip_vs_nat_icmp(skb,pp,cp,1);-#ifdef CONFIG_IP_VS_IPV6-if(af==AF_INET6){-if(ipvs->sysctl_snat_reroute&&ip6_route_me_harder(skb)!=0)-gotoout;-}else-#endif-if((ipvs->sysctl_snat_reroute||-skb_rtable(skb)->rt_flags&RTCF_LOCAL)&&-ip_route_me_harder(skb,RTN_LOCAL)!=0)-gotoout;+if(ip_vs_route_me_harder(af,skb))+gotoout;/* do the statistics and put it back */ip_vs_out_stats(cp,skb);
From: Simon Horman <horms@verge.net.au> Date: 2011-03-14 03:45:34
In preparation for not including sysctl_snat_reroute in
struct netns_ipvs when CONFIG_SYCTL is not defined.
Signed-off-by: Simon Horman <horms@verge.net.au>
---
net/netfilter/ipvs/ip_vs_core.c | 20 ++++++++++++++++----
1 files changed, 16 insertions(+), 4 deletions(-)
From: Simon Horman <horms@verge.net.au> Date: 2011-03-14 03:45:35
In preparation for not including sysctl_nat_icmp_send in
struct netns_ipvs when CONFIG_SYCTL is not defined.
Signed-off-by: Simon Horman <horms@verge.net.au>
---
net/netfilter/ipvs/ip_vs_core.c | 11 ++++++++---
1 files changed, 8 insertions(+), 3 deletions(-)
From: Simon Horman <horms@verge.net.au> Date: 2011-03-14 03:45:36
In preparation for not including sysctl_sync_threshold in
struct netns_ipvs when CONFIG_SYCTL is not defined.
Signed-off-by: Simon Horman <horms@verge.net.au>
---
include/net/ip_vs.h | 29 +++++++++++++++++++++++++++++
net/netfilter/ipvs/ip_vs_core.c | 10 +++++-----
net/netfilter/ipvs/ip_vs_ctl.c | 4 ++--
net/netfilter/ipvs/ip_vs_sync.c | 4 ++--
4 files changed, 38 insertions(+), 9 deletions(-)
@@ -3569,8 +3569,8 @@ int __net_init __ip_vs_control_init(struct net *net)tbl[idx++].data=&ipvs->sysctl_cache_bypass;tbl[idx++].data=&ipvs->sysctl_expire_nodest_conn;tbl[idx++].data=&ipvs->sysctl_expire_quiescent_template;-ipvs->sysctl_sync_threshold[0]=3;-ipvs->sysctl_sync_threshold[1]=50;+ipvs->sysctl_sync_threshold[0]=DEFAULT_SYNC_THRESHOLD;+ipvs->sysctl_sync_threshold[1]=DEFAULT_SYNC_PERIOD;tbl[idx].data=&ipvs->sysctl_sync_threshold;tbl[idx++].maxlen=sizeof(ipvs->sysctl_sync_threshold);tbl[idx++].data=&ipvs->sysctl_nat_icmp_send;
From: Simon Horman <horms@verge.net.au> Date: 2011-03-14 03:45:37
In preparation for not including sysctl_sync_ver in
struct netns_ipvs when CONFIG_SYCTL is not defined.
Signed-off-by: Simon Horman <horms@verge.net.au>
---
include/net/ip_vs.h | 11 +++++++++++
net/netfilter/ipvs/ip_vs_sync.c | 4 ++--
2 files changed, 13 insertions(+), 2 deletions(-)
@@ -394,7 +394,7 @@ void ip_vs_sync_switch_mode(struct net *net, int mode)if(!(ipvs->sync_state&IP_VS_STATE_MASTER))return;-if(mode==ipvs->sysctl_sync_ver||!ipvs->sync_buff)+if(mode==sysctl_sync_ver(ipvs)||!ipvs->sync_buff)return;spin_lock_bh(&ipvs->sync_buff_lock);
@@ -521,7 +521,7 @@ void ip_vs_sync_conn(struct net *net, struct ip_vs_conn *cp)unsignedintlen,pe_name_len,pad;/* Handle old version of the protocol */-if(ipvs->sysctl_sync_ver==0){+if(sysctl_sync_ver(ipvs)==0){ip_vs_sync_conn_v0(net,cp);return;}
From: Simon Horman <horms@verge.net.au> Date: 2011-03-14 03:45:39
In preparation for not including sysctl_expire_quiescent_template in
struct netns_ipvs when CONFIG_SYCTL is not defined.
Signed-off-by: Simon Horman <horms@verge.net.au>
---
net/netfilter/ipvs/ip_vs_conn.c | 13 +++++++++++--
1 files changed, 11 insertions(+), 2 deletions(-)
@@ -696,8 +706,7 @@ int ip_vs_check_template(struct ip_vs_conn *ct)*/if((dest==NULL)||!(dest->flags&IP_VS_DEST_F_AVAILABLE)||-(ipvs->sysctl_expire_quiescent_template&&-(atomic_read(&dest->weight)==0))){+expire_quiescent_template(ipvs,dest)){IP_VS_DBG_BUF(9,"check_template: dest not available for ""protocol %s s:%s:%d v:%s:%d ""-> d:%s:%d\n",
From: Simon Horman <horms@verge.net.au> Date: 2011-03-14 03:45:45
Break out the portions of __ip_vs_control_init() and
__ip_vs_control_cleanup() where aren't necessary when
CONFIG_SYSCTL is undefined.
Signed-off-by: Simon Horman <horms@verge.net.au>
---
net/netfilter/ipvs/ip_vs_ctl.c | 98 +++++++++++++++++++++++++---------------
1 files changed, 62 insertions(+), 36 deletions(-)
@@ -88,6 +88,8 @@ static int __ip_vs_addr_is_local_v6(struct net *net,return0;}#endif++#ifdef CONFIG_SYSCTL/**update_defense_leveliscalledfromkeventdandfromsysctl,*soitneedstoprotectitselffromsoftirqs
@@ -1511,7 +1514,7 @@ static int ip_vs_zero_all(struct net *net)return0;}-+#ifdef CONFIG_SYSCTLstaticintproc_do_defense_mode(ctl_table*table,intwrite,void__user*buffer,size_t*lenp,loff_t*ppos)
@@ -1533,7 +1536,6 @@ proc_do_defense_mode(ctl_table *table, int write,returnrc;}-staticintproc_do_sync_threshold(ctl_table*table,intwrite,void__user*buffer,size_t*lenp,loff_t*ppos)
From: Simon Horman <horms@verge.net.au> Date: 2011-03-14 03:46:00
In preparation for not including sysctl_lblc{r}_expiration in
struct netns_ipvs when CONFIG_SYCTL is not defined.
Signed-off-by: Simon Horman <horms@verge.net.au>
---
net/netfilter/ipvs/ip_vs_lblc.c | 16 +++++++++++++---
net/netfilter/ipvs/ip_vs_lblcr.c | 21 +++++++++++++++------
2 files changed, 28 insertions(+), 9 deletions(-)
@@ -650,7 +660,6 @@ ip_vs_lblcr_schedule(struct ip_vs_service *svc, const struct sk_buff *skb)read_lock(&svc->sched_lock);en=ip_vs_lblcr_get(svc->af,tbl,&iph.daddr);if(en){-structnetns_ipvs*ipvs=net_ipvs(svc->net);/* We only hold a read lock, but this is atomic */en->lastuse=jiffies;
@@ -662,7 +671,7 @@ ip_vs_lblcr_schedule(struct ip_vs_service *svc, const struct sk_buff *skb)/* More than one destination + enough time passed by, cleanup */if(atomic_read(&en->set.size)>1&&time_after(jiffies,en->set.lastmod+-ipvs->sysctl_lblcr_expiration)){+sysctl_lblcr_expiration(svc))){structip_vs_dest*m;write_lock(&en->set.lock);
@@ -746,7 +755,7 @@ static int __net_init __ip_vs_lblcr_init(struct net *net)return-ENOMEM;}elseipvs->lblcr_ctl_table=vs_vars_table;-ipvs->sysctl_lblcr_expiration=24*60*60*HZ;+ipvs->sysctl_lblcr_expiration=DEFAULT_EXPIRATION;ipvs->lblcr_ctl_table[0].data=&ipvs->sysctl_lblcr_expiration;#ifdef CONFIG_SYSCTL
From: Simon Horman <horms@verge.net.au> Date: 2011-03-14 03:46:00
In preparation for not including sysctl_expire_nodest_conn in
struct netns_ipvs when CONFIG_SYCTL is not defined.
Signed-off-by: Simon Horman <horms@verge.net.au>
---
net/netfilter/ipvs/ip_vs_core.c | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
@@ -613,10 +613,16 @@ static int sysctl_nat_icmp_send(struct net *net)returnipvs->sysctl_nat_icmp_send;}+staticintsysctl_expire_nodest_conn(structnetns_ipvs*ipvs)+{+returnipvs->sysctl_expire_nodest_conn;+}+#elsestaticintsysctl_snat_reroute(structsk_buff*skb){return0;}staticintsysctl_nat_icmp_send(structnet*net){return0;}+staticintsysctl_expire_nodest_conn(structnetns_ipvs*ipvs){return0;}#endif
@@ -1583,7 +1589,7 @@ ip_vs_in(unsigned int hooknum, struct sk_buff *skb, int af)if(cp->dest&&!(cp->dest->flags&IP_VS_DEST_F_AVAILABLE)){/* the destination server is not available */-if(ipvs->sysctl_expire_nodest_conn){+if(sysctl_expire_nodest_conn(ipvs)){/* try to expire the connection immediately */ip_vs_conn_expire_now(cp);}
From: Simon Horman <horms@verge.net.au> Date: 2011-03-14 03:46:01
ip_vs_lblc_table and ip_vs_lblcr_table, and code that uses them
are unnecessary when CONFIG_SYSCTL is undefined.
Signed-off-by: Simon Horman <horms@verge.net.au>
---
net/netfilter/ipvs/ip_vs_lblc.c | 15 ++++++++++-----
net/netfilter/ipvs/ip_vs_lblcr.c | 14 ++++++++++----
2 files changed, 20 insertions(+), 9 deletions(-)
From: Simon Horman <horms@verge.net.au> Date: 2011-03-14 03:46:02
Much of ip_vs_leave() is unnecessary if CONFIG_SYSCTL is undefined.
I tried an approach of breaking the now #ifdef'ed portions out
into a separate function. However this appeared to grow the
compiled code on x86_64 by about 200 bytes in the case where
CONFIG_SYSCTL is defined. So I have gone with the simpler though
less elegant #ifdef'ed solution for now.
Signed-off-by: Simon Horman <horms@verge.net.au>
---
net/netfilter/ipvs/ip_vs_core.c | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
From: Simon Horman <horms@verge.net.au> Date: 2011-03-14 03:46:02
There is now no need to include sysctl members of struct netns_ipvs
unless CONFIG_SYSCTL is defined.
Signed-off-by: Simon Horman <horms@verge.net.au>
---
include/net/ip_vs.h | 21 +++++++++++++--------
1 files changed, 13 insertions(+), 8 deletions(-)
@@ -839,6 +839,17 @@ struct netns_ipvs {structip_vs_statstot_stats;/* Statistics & est. */intnum_services;/* no of virtual services */++rwlock_trs_lock;/* real services table */+/* semaphore for IPVS sockopts. And, [gs]etsockopt may sleep. */+structlock_class_keyctl_key;/* ctl_mutex debuging */+/* Trash for destinations */+structlist_headdest_trash;+/* Service counters */+atomic_tftpsvc_counter;+atomic_tnullsvc_counter;++#ifdef CONFIG_SYSCTL/* 1/rate drop and drop-entry variables */structdelayed_workdefense_work;/* Work handler */intdrop_rate;
@@ -848,18 +859,12 @@ struct netns_ipvs {spinlock_tdropentry_lock;/* drop entry handling */spinlock_tdroppacket_lock;/* drop packet handling */spinlock_tsecuretcp_lock;/* state and timeout tables */-rwlock_trs_lock;/* real services table */-/* semaphore for IPVS sockopts. And, [gs]etsockopt may sleep. */-structlock_class_keyctl_key;/* ctl_mutex debuging */-/* Trash for destinations */-structlist_headdest_trash;-/* Service counters */-atomic_tftpsvc_counter;-atomic_tnullsvc_counter;/* sys-ctl struct */structctl_table_header*sysctl_hdr;structctl_table*sysctl_tbl;+#endif+/* sysctl variables */intsysctl_amemthresh;intsysctl_am_droprate;
From: Simon Horman <horms@verge.net.au> Date: 2011-03-14 03:46:02
ip_vs_conntrack_enabled() becomes a noop when CONFIG_SYSCTL is undefined.
In preparation for not including sysctl_conntrack in
struct netns_ipvs when CONFIG_SYCTL is not defined.
Signed-off-by: Simon Horman <horms@verge.net.au>
---
include/net/ip_vs.h | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
From: Eric Dumazet <hidden> Date: 2011-03-14 04:09:09
Le lundi 14 mars 2011 à 12:45 +0900, Simon Horman a écrit :
From: Julian Anastasov <ja@ssi.bg>
Currently, the new percpu counters are not zeroed and
the zero commands do not work as expected, we still show the old
sum of percpu values. OTOH, we can not reset the percpu counters
from user context without causing the incrementing to use old
and bogus values.
So, as Eric Dumazet suggested fix that by moving all overhead
to stats reading in user context. Do not introduce overhead in
timer context (estimator) and incrementing (packet handling in
softirqs).
The new ustats0 field holds the zero point for all
counter values, the rates always use 0 as base value as before.
When showing the values to user space just give the difference
between counters and the base values. The only drawback is that
percpu stats are not zeroed, they are accessible only from /proc
and are new interface, so it should not be a compatibility problem
as long as the sum stats are correct after zeroing.
Signed-off-by: Julian Anastasov <ja@ssi.bg>
Signed-off-by: Simon Horman <horms@verge.net.au>
From: Eric Dumazet <hidden> Date: 2011-03-14 04:28:23
Le lundi 14 mars 2011 à 12:45 +0900, Simon Horman a écrit :
From: Julian Anastasov <ja@ssi.bg>
The global tot_stats contains cpustats field just like the
stats for dest and svc, so better use it to simplify the usage
in estimation_timer. As tot_stats is registered as estimator
we can remove the special ip_vs_read_cpu_stats call for
tot_stats. Fix ip_vs_read_cpu_stats to be called under
stats lock because it is still used as synchronization between
estimation timer and user context (the stats readers).
Also, make sure ip_vs_stats_percpu_show reads properly
the u64 stats from user context.
Signed-off-by: Julian Anastasov <ja@ssi.bg>
Signed-off-by: Simon Horman <horms@verge.net.au>
Reviewed-by: Eric Dumazet <redacted>
One comment : per cpu stats are really good to avoid cache misses, but I
see tot_stats is included in struct netns_ipvs right after "conn_count",
possibly sharing a hot cache line ?
Thanks
Also, make sure ip_vs_stats_percpu_show reads properly
the u64 stats from user context.
Signed-off-by: Julian Anastasov <ja@ssi.bg>
Signed-off-by: Simon Horman <horms@verge.net.au>
Reviewed-by: Eric Dumazet <redacted>
One comment : per cpu stats are really good to avoid cache misses, but I
see tot_stats is included in struct netns_ipvs right after "conn_count",
possibly sharing a hot cache line ?
conn_count and tcp_app_lock, udp_app_lock, sctp_app_lock
are used when packet creates new connection, probably on the
same time depending on the protocol in packet. May be conn_count
better to be before tcp_apps, far away from some sysctl vars
that are mostly read?
For tot_stats: cpustats ptr is always read,
other fields in tot_stats are updated from the 2-second
timer. May be it is better just to move tot_stats before
est_list, it is written at the same time?
Regards
--
Julian Anastasov [off-list ref]