mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-27 12:57:53 +00:00
bpf: report RCU QS in cpumap kthread
[ Upstream commit00bf631224
] 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:6710e11269
("bpf: introduce new bpf cpu map type BPF_MAP_TYPE_CPUMAP") Reviewed-by: Jesper Dangaard Brouer <hawk@kernel.org> Signed-off-by: Yan Zhai <yan@cloudflare.com> Acked-by: Paul E. McKenney <paulmck@kernel.org> Acked-by: Jesper Dangaard Brouer <hawk@kernel.org> Link: https://lore.kernel.org/r/c17b9f1517e19d813da3ede5ed33ee18496bb5d8.1710877680.git.yan@cloudflare.com Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
2f1d402dcc
commit
387daae8b0
1 changed files with 3 additions and 0 deletions
|
@ -305,6 +305,7 @@ static int cpu_map_bpf_prog_run(struct bpf_cpu_map_entry *rcpu, void **frames,
|
||||||
static int cpu_map_kthread_run(void *data)
|
static int cpu_map_kthread_run(void *data)
|
||||||
{
|
{
|
||||||
struct bpf_cpu_map_entry *rcpu = data;
|
struct bpf_cpu_map_entry *rcpu = data;
|
||||||
|
unsigned long last_qs = jiffies;
|
||||||
|
|
||||||
complete(&rcpu->kthread_running);
|
complete(&rcpu->kthread_running);
|
||||||
set_current_state(TASK_INTERRUPTIBLE);
|
set_current_state(TASK_INTERRUPTIBLE);
|
||||||
|
@ -330,10 +331,12 @@ static int cpu_map_kthread_run(void *data)
|
||||||
if (__ptr_ring_empty(rcpu->queue)) {
|
if (__ptr_ring_empty(rcpu->queue)) {
|
||||||
schedule();
|
schedule();
|
||||||
sched = 1;
|
sched = 1;
|
||||||
|
last_qs = jiffies;
|
||||||
} else {
|
} else {
|
||||||
__set_current_state(TASK_RUNNING);
|
__set_current_state(TASK_RUNNING);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
rcu_softirq_qs_periodic(last_qs);
|
||||||
sched = cond_resched();
|
sched = cond_resched();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue