Re: can anyone explain the meaning of improvement of try_attach function in sysctl.c?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi lin jia,

thanks for posting to the list.
I'll also add Joel, Kees, Luis and the fsdevel lists to Cc, as per
"PROC SYSCTL" from the MAINTAINERS file.

On 2024-06-29 10:54:15+0000, lin jia wrote:
> Hi all:
>    I've been reading the sysctl part of the Linux kernel source code( 3.3.8) recently and encountered some issues. I'm not sure who I can ask for help.
>    In sysctl.c ,  the function of __register_sysctl_paths is to register a sysctl hierarchy,  I am confused by the function " try_attach", 

This is a very old kernel.

The function you mention was removed over ten years ago and the way
sysctls are registered today is completely different.

> /* see if attaching q to p would be an improvement */
> static void try_attach(struct ctl_table_header *p, struct ctl_table_header *q)
> 
> what is the meaning of "improvement",  I don’t know the matching standard for the entry in the list
> 
> another question is , why not break when variable is_better and
> not_in_parent is true, so as to save time,  when I config about 2k~4k
> net device objects in system,  "register_net_sysctl_table" cost
> considerable time.

try_attach() was removed in
commit 7ec66d06362d ("sysctl: Stop requiring explicit management of sysctl directories")
citing performance reasons.
This may be same performance issue you are encountering and maybe you
can take inspiration from that commit to avoid it.

Or even better, upgrade to a newer kernel.

> <snip>


Thomas




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux