Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

cgroup, netclassid: on modifying netclassid in cgroup, only consider the main process.

When modifying netclassid, the command("echo 0x100001 > net_cls.classid")
will take more time on many threads of one process, because the process
create many fds.
for example, one process exists 28000 fds and 60000 threads, echo command
will task 45 seconds.
Now, we only consider the main process when exec "iterate_fd", and the
time is about 52 milliseconds.

Signed-off-by: Liansen Zhai <zhailiansen@kuaishou.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://lore.kernel.org/r/20231012090330.29636-1-zhailiansen@kuaishou.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Liansen Zhai and committed by
Jakub Kicinski
c60991f8 1cfce826

+6
+6
net/core/netclassid_cgroup.c
··· 88 88 }; 89 89 unsigned int fd = 0; 90 90 91 + /* Only update the leader task, when many threads in this task, 92 + * so it can avoid the useless traversal. 93 + */ 94 + if (p != p->group_leader) 95 + return; 96 + 91 97 do { 92 98 task_lock(p); 93 99 fd = iterate_fd(p->files, fd, update_classid_sock, &ctx);