Skip to content

Commit 2a0c6b4

Browse files
Hou TaoAlexei Starovoitov
authored andcommitted
bpf: Update the comments in maybe_wait_bpf_programs()
Since commit 638e4b8 ("bpf: Allows per-cpu maps and map-in-map in sleepable programs"), sleepable BPF program can also use map-in-map, but maybe_wait_bpf_programs() doesn't handle it accordingly. The main reason is that using synchronize_rcu_tasks_trace() to wait for the completions of these sleepable BPF programs may incur a very long delay and userspace may think it is hung, so the wait for sleepable BPF programs is skipped. Update the comments in maybe_wait_bpf_programs() to reflect the reason. Signed-off-by: Hou Tao <[email protected]> Acked-by: Yonghong Song <[email protected]> Acked-by: John Fastabend <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexei Starovoitov <[email protected]>
1 parent b13cddf commit 2a0c6b4

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

kernel/bpf/syscall.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,9 +142,13 @@ static u32 bpf_map_value_size(const struct bpf_map *map)
142142

143143
static void maybe_wait_bpf_programs(struct bpf_map *map)
144144
{
145-
/* Wait for any running BPF programs to complete so that
146-
* userspace, when we return to it, knows that all programs
147-
* that could be running use the new map value.
145+
/* Wait for any running non-sleepable BPF programs to complete so that
146+
* userspace, when we return to it, knows that all non-sleepable
147+
* programs that could be running use the new map value. For sleepable
148+
* BPF programs, synchronize_rcu_tasks_trace() should be used to wait
149+
* for the completions of these programs, but considering the waiting
150+
* time can be very long and userspace may think it will hang forever,
151+
* so don't handle sleepable BPF programs now.
148152
*/
149153
if (map->map_type == BPF_MAP_TYPE_HASH_OF_MAPS ||
150154
map->map_type == BPF_MAP_TYPE_ARRAY_OF_MAPS)

0 commit comments

Comments
 (0)