Permalink
Browse files

Try to keep rate and spinlock in the same cacheline

  • Loading branch information...
1 parent e533271 commit 49a66f0cd28683cfa6865a385e65f85d78323300 @jvimal committed Feb 15, 2012
Showing with 6 additions and 4 deletions.
  1. +2 −2 rl.c
  2. +4 −2 rl.h
View
4 rl.c
@@ -66,7 +66,7 @@ void iso_rl_show(struct iso_rl *rl, struct seq_file *s) {
struct iso_rl_queue *q;
int i, first = 1;
- seq_printf(s, "ip %x rate %llu total_tokens %llu last %llx %p\n",
+ seq_printf(s, "ip %x rate %u total_tokens %llu last %llx %p\n",
rl->ip, rl->rate, rl->total_tokens, *(u64 *)&rl->last_update_time, rl);
for_each_online_cpu(i) {
@@ -98,7 +98,7 @@ inline void iso_rl_clock(struct iso_rl *rl) {
rl->total_tokens += (rl->rate * us) >> 3;
/* This is needed if we have TSO. MIN_BURST_BYTES will be ~64K */
- cap = max((rl->rate * ISO_MAX_BURST_TIME_US) >> 3, (u64)ISO_MIN_BURST_BYTES);
+ cap = max((rl->rate * ISO_MAX_BURST_TIME_US) >> 3, (u32)ISO_MIN_BURST_BYTES);
rl->total_tokens = min(cap, rl->total_tokens);
rl->last_update_time = now;
View
6 rl.h
@@ -46,14 +46,16 @@ struct iso_rl_queue {
};
struct iso_rl {
+ /* Try to keep rate and spinlock in the same cacheline */
+ u32 rate;
+ spinlock_t spinlock;
+
__le32 ip;
- u64 rate;
u64 total_tokens;
u64 accum_xmit;
u64 accum_enqueued;
ktime_t last_update_time;
- spinlock_t spinlock;
struct iso_rl_queue __percpu *queue;
struct hlist_node hash_node;

0 comments on commit 49a66f0

Please sign in to comment.