LVS
lvs-devel
Google
 
Web LinuxVirtualServer.org

[PATCH 3/4] ipvs: zero percpu stats

To: Simon Horman <horms@xxxxxxxxxxxx>
Subject: [PATCH 3/4] ipvs: zero percpu stats
Cc: lvs-devel@xxxxxxxxxxxxxxx, Hans Schillström <hans.schillstrom@xxxxxxxxxxxx>
From: Julian Anastasov <ja@xxxxxx>
Date: Fri, 4 Mar 2011 12:22:08 +0200 (EET)

        Zero the new percpu stats because we copy from there.

Signed-off-by: Julian Anastasov <ja@xxxxxx>
---

diff -urp lvs-test-2.6-8a80c79/linux/net/netfilter/ipvs/ip_vs_ctl.c 
linux/net/netfilter/ipvs/ip_vs_ctl.c
--- lvs-test-2.6-8a80c79/linux/net/netfilter/ipvs/ip_vs_ctl.c   2011-03-03 
23:10:42.000000000 +0200
+++ linux/net/netfilter/ipvs/ip_vs_ctl.c        2011-03-04 00:19:51.078379585 
+0200
@@ -713,8 +713,25 @@ static void ip_vs_trash_cleanup(struct n
 static void
 ip_vs_zero_stats(struct ip_vs_stats *stats)
 {
+       struct ip_vs_cpu_stats *cpustats = stats->cpustats;
+       int i;
+
        spin_lock_bh(&stats->lock);

+       for_each_possible_cpu(i) {
+               struct ip_vs_cpu_stats *u = per_cpu_ptr(cpustats, i);
+               unsigned int start;
+
+               /* Do not pretend to be writer, it is enough to
+                * sync with writers that modify the u64 counters
+                * because under stats->lock we are the only reader.
+                */
+               do {
+                       start = u64_stats_fetch_begin(&u->syncp);
+                       memset(&u->ustats, 0, sizeof(u->ustats));
+               } while (u64_stats_fetch_retry(&u->syncp, start));
+       }
+
        memset(&stats->ustats, 0, sizeof(stats->ustats));
        ip_vs_zero_estimator(stats);

--
To unsubscribe from this list: send the line "unsubscribe lvs-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

<Prev in Thread] Current Thread [Next in Thread>
  • [PATCH 3/4] ipvs: zero percpu stats, Julian Anastasov <=