Skip to content

Commit 5fcee13

Browse files
Yan ZhaiSasha Levin
Yan Zhai
authored and
Sasha Levin
committed
bpf: report RCU QS in cpumap kthread
[ Upstream commit 00bf631 ] 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]> Signed-off-by: Sasha Levin <[email protected]>
1 parent e92971a commit 5fcee13

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

kernel/bpf/cpumap.c

+3
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,7 @@ static int cpu_map_bpf_prog_run(struct bpf_cpu_map_entry *rcpu, void **frames,
262262
static int cpu_map_kthread_run(void *data)
263263
{
264264
struct bpf_cpu_map_entry *rcpu = data;
265+
unsigned long last_qs = jiffies;
265266

266267
complete(&rcpu->kthread_running);
267268
set_current_state(TASK_INTERRUPTIBLE);
@@ -287,10 +288,12 @@ static int cpu_map_kthread_run(void *data)
287288
if (__ptr_ring_empty(rcpu->queue)) {
288289
schedule();
289290
sched = 1;
291+
last_qs = jiffies;
290292
} else {
291293
__set_current_state(TASK_RUNNING);
292294
}
293295
} else {
296+
rcu_softirq_qs_periodic(last_qs);
294297
sched = cond_resched();
295298
}
296299

0 commit comments

Comments
 (0)