Skip to content

Commit 1c08297

Browse files
Sebastian Andrzej SiewiorPaolo Abeni
authored andcommitted
ipv4/route: Use this_cpu_inc() for stats on PREEMPT_RT
The statistics are incremented with raw_cpu_inc() assuming it always happens with bottom half disabled. Without per-CPU locking in local_bh_disable() on PREEMPT_RT this is no longer true. Use this_cpu_inc() on PREEMPT_RT for the increment to not worry about preemption. Cc: David Ahern <[email protected]> Signed-off-by: Sebastian Andrzej Siewior <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Paolo Abeni <[email protected]>
1 parent c99dac5 commit 1c08297

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

net/ipv4/route.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,11 @@ const __u8 ip_tos2prio[16] = {
189189
EXPORT_SYMBOL(ip_tos2prio);
190190

191191
static DEFINE_PER_CPU(struct rt_cache_stat, rt_cache_stat);
192+
#ifndef CONFIG_PREEMPT_RT
192193
#define RT_CACHE_STAT_INC(field) raw_cpu_inc(rt_cache_stat.field)
194+
#else
195+
#define RT_CACHE_STAT_INC(field) this_cpu_inc(rt_cache_stat.field)
196+
#endif
193197

194198
#ifdef CONFIG_PROC_FS
195199
static void *rt_cache_seq_start(struct seq_file *seq, loff_t *pos)

0 commit comments

Comments
 (0)