summaryrefslogtreecommitdiff
path: root/include/net/act_api.h
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2015-07-06 15:18:08 +0300
committerDavid S. Miller <davem@davemloft.net>2015-07-08 23:50:42 +0300
commit56e5d1ca183d8616fab377d7d466c244b4dbb3b9 (patch)
tree9896c9a5de0b99e32c2d3a06f5a0c4503b1fffbd /include/net/act_api.h
parent8f2ae965b7ef4f4ddab6110f06388e270723d694 (diff)
downloadlinux-56e5d1ca183d8616fab377d7d466c244b4dbb3b9.tar.xz
net_sched: act_gact: remove spinlock in fast path
Final step for gact RCU operation : 1) Use percpu stats 2) update lastuse only every clock tick to avoid false sharing 3) Remove spinlock acquisition, as it is no longer needed. Since this is the last contended lock in packet RX when tc gact is used, this gives impressive gain. My host with 8 RX queues was handling 5 Mpps before the patch, and more than 11 Mpps after patch. Tested: On receiver : dev=eth0 tc qdisc del dev $dev ingress 2>/dev/null tc qdisc add dev $dev ingress tc filter del dev $dev root pref 10 2>/dev/null tc filter del dev $dev pref 10 2>/dev/null tc filter add dev $dev est 1sec 4sec parent ffff: protocol ip prio 1 \ u32 match ip src 7.0.0.0/8 flowid 1:15 action drop Sender sends packets flood from 7/8 network Signed-off-by: Eric Dumazet <edumazet@google.com> Acked-by: Alexei Starovoitov <ast@plumgrid.com> Acked-by: Jamal Hadi Salim <jhs@mojatatu.com> Acked-by: John Fastabend <john.fastabend@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/act_api.h')
-rw-r--r--include/net/act_api.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/include/net/act_api.h b/include/net/act_api.h
index db2063ffd181..8d2a707a9e87 100644
--- a/include/net/act_api.h
+++ b/include/net/act_api.h
@@ -70,6 +70,17 @@ static inline void tcf_hashinfo_destroy(struct tcf_hashinfo *hf)
kfree(hf->htab);
}
+/* Update lastuse only if needed, to avoid dirtying a cache line.
+ * We use a temp variable to avoid fetching jiffies twice.
+ */
+static inline void tcf_lastuse_update(struct tcf_t *tm)
+{
+ unsigned long now = jiffies;
+
+ if (tm->lastuse != now)
+ tm->lastuse = now;
+}
+
#ifdef CONFIG_NET_CLS_ACT
#define ACT_P_CREATED 1