WSL2-Linux-Kernel/kernel/bpf
Yonghong Song 203d7b054f bpf: Avoid iterating duplicated files for task_file iterator
Currently, task_file iterator iterates all files from all tasks.
This may potentially visit a lot of duplicated files if there are
many tasks sharing the same files, e.g., typical pthreads
where these pthreads and the main thread are sharing the same files.

This patch changed task_file iterator to skip a particular task
if that task shares the same files as its group_leader (the task
having the same tgid and also task->tgid == task->pid).
This will preserve the same result, visiting all files from all
tasks, and will reduce runtime cost significantl, e.g., if there are
a lot of pthreads and the process has a lot of open files.

Suggested-by: Andrii Nakryiko <andriin@fb.com>
Signed-off-by: Yonghong Song <yhs@fb.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Link: https://lore.kernel.org/bpf/20200902023112.1672792-1-yhs@fb.com
2020-09-02 16:40:33 +02:00
..
preload bpf: Disallow BPF_PRELOAD in allmodconfig builds 2020-08-25 15:23:46 -07:00
Makefile bpf: Implement bpf_local_storage for inodes 2020-08-25 15:00:04 -07:00
arraymap.c bpf: Introduce sleepable BPF programs 2020-08-28 21:20:33 +02:00
bpf_inode_storage.c bpf: Add map_meta_equal map ops 2020-08-28 15:41:30 +02:00
bpf_iter.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next 2020-09-01 13:22:59 -07:00
bpf_local_storage.c bpf: Split bpf_local_storage to bpf_sk_storage 2020-08-25 15:00:04 -07:00
bpf_lru_list.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 206 2019-05-30 11:29:53 -07:00
bpf_lru_list.h bpf: Fix a typo "inacitve" -> "inactive" 2020-04-06 21:54:10 +02:00
bpf_lsm.c bpf: Allow local storage to be used from LSM programs 2020-08-25 15:00:04 -07:00
bpf_struct_ops.c bpf: Move btf_resolve_size into __btf_resolve_size 2020-08-25 15:37:41 -07:00
bpf_struct_ops_types.h bpf: tcp: Support tcp_congestion_ops in bpf 2020-01-09 08:46:18 -08:00
btf.c bpf: Add BTF_SET_START/END macros 2020-08-25 15:37:41 -07:00
cgroup.c bpf: Add support for forced LINK_DETACH command 2020-08-01 20:38:28 -07:00
core.c bpf: Delete repeated words in comments 2020-08-07 18:57:24 +02:00
cpumap.c bpf: {cpu,dev}map: Change various functions return type from int to void 2020-09-01 15:45:58 +02:00
devmap.c bpf: {cpu,dev}map: Change various functions return type from int to void 2020-09-01 15:45:58 +02:00
disasm.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 295 2019-06-05 17:36:38 +02:00
disasm.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 295 2019-06-05 17:36:38 +02:00
dispatcher.c bpf: Remove bpf_image tree 2020-03-13 12:49:52 -07:00
hashtab.c bpf: Introduce sleepable BPF programs 2020-08-28 21:20:33 +02:00
helpers.c bpf: Add bpf_copy_from_user() helper. 2020-08-28 21:20:33 +02:00
inode.c bpf: Add kernel module with user mode driver that populates bpffs. 2020-08-20 16:02:36 +02:00
local_storage.c bpf/local_storage: Fix build without CONFIG_CGROUP 2020-07-25 20:16:36 -07:00
lpm_trie.c bpf: Add map_meta_equal map ops 2020-08-28 15:41:30 +02:00
map_in_map.c bpf: Relax max_entries check for most of the inner map types 2020-08-28 15:41:30 +02:00
map_in_map.h bpf: Add map_meta_equal map ops 2020-08-28 15:41:30 +02:00
map_iter.c bpf: Implement link_query callbacks in map element iterators 2020-08-21 14:01:39 -07:00
net_namespace.c bpf: Add support for forced LINK_DETACH command 2020-08-01 20:38:28 -07:00
offload.c bpf, offload: Replace bitwise AND by logical AND in bpf_prog_offload_info_fill 2020-02-17 16:53:49 +01:00
percpu_freelist.c bpf: Dont iterate over possible CPUs with interrupts disabled 2020-02-24 16:18:20 -08:00
percpu_freelist.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 206 2019-05-30 11:29:53 -07:00
prog_iter.c bpf: Refactor bpf_iter_reg to have separate seq_info member 2020-07-25 20:16:32 -07:00
queue_stack_maps.c bpf: Add map_meta_equal map ops 2020-08-28 15:41:30 +02:00
reuseport_array.c bpf: Add map_meta_equal map ops 2020-08-28 15:41:30 +02:00
ringbuf.c bpf: Add map_meta_equal map ops 2020-08-28 15:41:30 +02:00
stackmap.c bpf: Add map_meta_equal map ops 2020-08-28 15:41:30 +02:00
syscall.c bpf: Introduce sleepable BPF programs 2020-08-28 21:20:33 +02:00
sysfs_btf.c bpf: Support llvm-objcopy for vmlinux BTF 2020-03-19 12:32:38 +01:00
task_iter.c bpf: Avoid iterating duplicated files for task_file iterator 2020-09-02 16:40:33 +02:00
tnum.c bpf: Verifier, do explicit ALU32 bounds tracking 2020-03-30 14:59:53 -07:00
trampoline.c bpf: Remove bpf_lsm_file_mprotect from sleepable list. 2020-08-31 23:03:57 +02:00
verifier.c bpf: Remove bpf_lsm_file_mprotect from sleepable list. 2020-08-31 23:03:57 +02:00