diff options
author | Joanne Koong <joannelkoong@gmail.com> | 2022-03-17 21:55:52 -0700 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2022-03-20 18:55:05 -0700 |
commit | b00fa38a9c1cba044a32a601b49a55a18ed719d1 (patch) | |
tree | 871c74ded225f4bd7108f611a7a8e86f1642e16c /kernel/bpf/offload.c | |
parent | a8fee96202e279441d0e52d83eb100bd4a6d6272 (diff) |
bpf: Enable non-atomic allocations in local storage
Currently, local storage memory can only be allocated atomically
(GFP_ATOMIC). This restriction is too strict for sleepable bpf
programs.
In this patch, the verifier detects whether the program is sleepable,
and passes the corresponding GFP_KERNEL or GFP_ATOMIC flag as a
5th argument to bpf_task/sk/inode_storage_get. This flag will propagate
down to the local storage functions that allocate memory.
Please note that bpf_task/sk/inode_storage_update_elem functions are
invoked by userspace applications through syscalls. Preemption is
disabled before bpf_task/sk/inode_storage_update_elem is called, which
means they will always have to allocate memory atomically.
Signed-off-by: Joanne Koong <joannelkoong@gmail.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: KP Singh <kpsingh@kernel.org>
Acked-by: Martin KaFai Lau <kafai@fb.com>
Link: https://lore.kernel.org/bpf/20220318045553.3091807-2-joannekoong@fb.com
Diffstat (limited to 'kernel/bpf/offload.c')
0 files changed, 0 insertions, 0 deletions