Skip to content

Commit

Permalink
netfilter: xt_rateest: Better struct xt_rateest layout
Browse files Browse the repository at this point in the history
We currently dirty two cache lines in struct xt_rateest, this hurts SMP
performance.

This patch moves lock/bstats/rstats at beginning of structure so that
they share a single cache line.

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: Patrick McHardy <kaber@trash.net>
  • Loading branch information
Eric Dumazet authored and Patrick McHardy committed Jun 8, 2010
1 parent e12f8e2 commit 339bb99
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions include/net/netfilter/xt_rateest.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,17 @@
#define _XT_RATEEST_H

struct xt_rateest {
/* keep lock and bstats on same cache line to speedup xt_rateest_tg() */
struct gnet_stats_basic_packed bstats;
spinlock_t lock;
/* keep rstats and lock on same cache line to speedup xt_rateest_mt() */
struct gnet_stats_rate_est rstats;

/* following fields not accessed in hot path */
struct hlist_node list;
char name[IFNAMSIZ];
unsigned int refcnt;
spinlock_t lock;
struct gnet_estimator params;
struct gnet_stats_rate_est rstats;
struct gnet_stats_basic_packed bstats;
};

extern struct xt_rateest *xt_rateest_lookup(const char *name);
Expand Down

0 comments on commit 339bb99

Please sign in to comment.