Skip to content

Commit 00bf631

Browse files
Yan Zhaikuba-moo
authored andcommitted
bpf: report RCU QS in cpumap kthread
When there are heavy load, cpumap kernel threads can be busy polling packets from redirect queues and block out RCU tasks from reaching quiescent states. It is insufficient to just call cond_resched() in such context. Periodically raise a consolidated RCU QS before cond_resched fixes the problem. Fixes: 6710e11 ("bpf: introduce new bpf cpu map type BPF_MAP_TYPE_CPUMAP") Reviewed-by: Jesper Dangaard Brouer <[email protected]> Signed-off-by: Yan Zhai <[email protected]> Acked-by: Paul E. McKenney <[email protected]> Acked-by: Jesper Dangaard Brouer <[email protected]> Link: https://lore.kernel.org/r/c17b9f1517e19d813da3ede5ed33ee18496bb5d8.1710877680.git.yan@cloudflare.com Signed-off-by: Jakub Kicinski <[email protected]>
1 parent d6dbbb1 commit 00bf631

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

kernel/bpf/cpumap.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,7 @@ static int cpu_map_bpf_prog_run(struct bpf_cpu_map_entry *rcpu, void **frames,
263263
static int cpu_map_kthread_run(void *data)
264264
{
265265
struct bpf_cpu_map_entry *rcpu = data;
266+
unsigned long last_qs = jiffies;
266267

267268
complete(&rcpu->kthread_running);
268269
set_current_state(TASK_INTERRUPTIBLE);
@@ -288,10 +289,12 @@ static int cpu_map_kthread_run(void *data)
288289
if (__ptr_ring_empty(rcpu->queue)) {
289290
schedule();
290291
sched = 1;
292+
last_qs = jiffies;
291293
} else {
292294
__set_current_state(TASK_RUNNING);
293295
}
294296
} else {
297+
rcu_softirq_qs_periodic(last_qs);
295298
sched = cond_resched();
296299
}
297300

0 commit comments

Comments
 (0)