diff options
-rw-r--r-- | net/core/drop_monitor.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/net/core/drop_monitor.c b/net/core/drop_monitor.c index 7592943513e3..a7cad741df01 100644 --- a/net/core/drop_monitor.c +++ b/net/core/drop_monitor.c | |||
@@ -49,6 +49,7 @@ struct per_cpu_dm_data { | |||
49 | struct sk_buff __rcu *skb; | 49 | struct sk_buff __rcu *skb; |
50 | atomic_t dm_hit_count; | 50 | atomic_t dm_hit_count; |
51 | struct timer_list send_timer; | 51 | struct timer_list send_timer; |
52 | int cpu; | ||
52 | }; | 53 | }; |
53 | 54 | ||
54 | struct dm_hw_stat_delta { | 55 | struct dm_hw_stat_delta { |
@@ -73,7 +74,6 @@ static int dm_hit_limit = 64; | |||
73 | static int dm_delay = 1; | 74 | static int dm_delay = 1; |
74 | static unsigned long dm_hw_check_delta = 2*HZ; | 75 | static unsigned long dm_hw_check_delta = 2*HZ; |
75 | static LIST_HEAD(hw_stats_list); | 76 | static LIST_HEAD(hw_stats_list); |
76 | static int initialized = 0; | ||
77 | 77 | ||
78 | static void reset_per_cpu_data(struct per_cpu_dm_data *data) | 78 | static void reset_per_cpu_data(struct per_cpu_dm_data *data) |
79 | { | 79 | { |
@@ -96,8 +96,8 @@ static void reset_per_cpu_data(struct per_cpu_dm_data *data) | |||
96 | sizeof(struct net_dm_alert_msg)); | 96 | sizeof(struct net_dm_alert_msg)); |
97 | msg = nla_data(nla); | 97 | msg = nla_data(nla); |
98 | memset(msg, 0, al); | 98 | memset(msg, 0, al); |
99 | } else if (initialized) | 99 | } else |
100 | schedule_work_on(smp_processor_id(), &data->dm_alert_work); | 100 | schedule_work_on(data->cpu, &data->dm_alert_work); |
101 | 101 | ||
102 | /* | 102 | /* |
103 | * Don't need to lock this, since we are guaranteed to only | 103 | * Don't need to lock this, since we are guaranteed to only |
@@ -121,6 +121,8 @@ static void send_dm_alert(struct work_struct *unused) | |||
121 | struct sk_buff *skb; | 121 | struct sk_buff *skb; |
122 | struct per_cpu_dm_data *data = &get_cpu_var(dm_cpu_data); | 122 | struct per_cpu_dm_data *data = &get_cpu_var(dm_cpu_data); |
123 | 123 | ||
124 | WARN_ON_ONCE(data->cpu != smp_processor_id()); | ||
125 | |||
124 | /* | 126 | /* |
125 | * Grab the skb we're about to send | 127 | * Grab the skb we're about to send |
126 | */ | 128 | */ |
@@ -404,14 +406,14 @@ static int __init init_net_drop_monitor(void) | |||
404 | 406 | ||
405 | for_each_present_cpu(cpu) { | 407 | for_each_present_cpu(cpu) { |
406 | data = &per_cpu(dm_cpu_data, cpu); | 408 | data = &per_cpu(dm_cpu_data, cpu); |
407 | reset_per_cpu_data(data); | 409 | data->cpu = cpu; |
408 | INIT_WORK(&data->dm_alert_work, send_dm_alert); | 410 | INIT_WORK(&data->dm_alert_work, send_dm_alert); |
409 | init_timer(&data->send_timer); | 411 | init_timer(&data->send_timer); |
410 | data->send_timer.data = cpu; | 412 | data->send_timer.data = cpu; |
411 | data->send_timer.function = sched_send_work; | 413 | data->send_timer.function = sched_send_work; |
414 | reset_per_cpu_data(data); | ||
412 | } | 415 | } |
413 | 416 | ||
414 | initialized = 1; | ||
415 | 417 | ||
416 | goto out; | 418 | goto out; |
417 | 419 | ||