LVS
lvs-devel
Google
 
Web LinuxVirtualServer.org

Re: [PATCH v2 03/14] sysctl: Add ctl_table_size to ctl_table_header

To: Joel Granados <joel.granados@xxxxxxxxx>
Subject: Re: [PATCH v2 03/14] sysctl: Add ctl_table_size to ctl_table_header
Cc: mcgrof@xxxxxxxxxx, Catalin Marinas <catalin.marinas@xxxxxxx>, Iurii Zaikin <yzaikin@xxxxxxxxxx>, Jozsef Kadlecsik <kadlec@xxxxxxxxxxxxx>, Sven Schnelle <svens@xxxxxxxxxxxxx>, Marcelo Ricardo Leitner <marcelo.leitner@xxxxxxxxx>, Steffen Klassert <steffen.klassert@xxxxxxxxxxx>, Kees Cook <keescook@xxxxxxxxxxxx>, "D. Wythe" <alibuda@xxxxxxxxxxxxxxxxx>, mptcp@xxxxxxxxxxxxxxx, Jakub Kicinski <kuba@xxxxxxxxxx>, Vasily Gorbik <gor@xxxxxxxxxxxxx>, Paolo Abeni <pabeni@xxxxxxxxxx>, coreteam@xxxxxxxxxxxxx, Jan Karcher <jaka@xxxxxxxxxxxxx>, Alexander Aring <alex.aring@xxxxxxxxx>, Will Deacon <will@xxxxxxxxxx>, Stefan Schmidt <stefan@xxxxxxxxxxxxxxxxxx>, Matthieu Baerts <matthieu.baerts@xxxxxxxxxxxx>, bridge@xxxxxxxxxxxxxxxxxxxxxxxxxx, linux-arm-kernel@xxxxxxxxxxxxxxxxxxx, Joerg Reuter <jreuter@xxxxxxxx>, Julian Anastasov <ja@xxxxxx>, David Ahern <dsahern@xxxxxxxxxx>, netfilter-devel@xxxxxxxxxxxxxxx, Wen Gu <guwen@xxxxxxxxxxxxxxxxx>, linux-kernel@xxxxxxxxxxxxxxx, Santosh Shilimkar <santosh.shilimkar@xxxxxxxxxx>, linux-wpan@xxxxxxxxxxxxxxx, lvs-devel@xxxxxxxxxxxxxxx, Karsten Graul <kgraul@xxxxxxxxxxxxx>, Miquel Raynal <miquel.raynal@xxxxxxxxxxx>, Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>, linux-sctp@xxxxxxxxxxxxxxx, Tony Lu <tonylu@xxxxxxxxxxxxxxxxx>, Pablo Neira Ayuso <pablo@xxxxxxxxxxxxx>, Ralf Baechle <ralf@xxxxxxxxxxxxxx>, Florian Westphal <fw@xxxxxxxxx>, willy@xxxxxxxxxxxxx, Heiko Carstens <hca@xxxxxxxxxxxxx>, "David S. Miller" <davem@xxxxxxxxxxxxx>, linux-rdma@xxxxxxxxxxxxxxx, Roopa Prabhu <roopa@xxxxxxxxxx>, Alexander Gordeev <agordeev@xxxxxxxxxxxxx>, Simon Horman <horms@xxxxxxxxxxxx>, Mat Martineau <martineau@xxxxxxxxxx>, josh@xxxxxxxxxxxxxxxx, Christian Borntraeger <borntraeger@xxxxxxxxxxxxx>, Eric Dumazet <edumazet@xxxxxxxxxx>, linux-hams@xxxxxxxxxxxxxxx, Wenjia Zhang <wenjia@xxxxxxxxxxxxx>, linux-fsdevel@xxxxxxxxxxxxxxx, linux-s390@xxxxxxxxxxxxxxx, Xin Long <lucien.xin@xxxxxxxxx>, Nikolay Aleksandrov <razor@xxxxxxxxxxxxx>, netdev@xxxxxxxxxxxxxxx, rds-devel@xxxxxxxxxxxxxx, Joel Granados <j.granados@xxxxxxxxxxx>
From: Simon Horman <horms@xxxxxxxxxx>
Date: Mon, 31 Jul 2023 20:30:21 +0200
On Mon, Jul 31, 2023 at 09:17:17AM +0200, Joel Granados wrote:
> The new ctl_table_size element will hold the size of the ctl_table
> arrays contained in the ctl_table_header. This value should eventually
> be passed by the callers to the sysctl register infrastructure. And
> while this commit introduces the variable, it does not set nor use it
> because that requires case by case considerations for each caller.
> 
> It provides two important things: (1) A place to put the
> result of the ctl_table array calculation when it gets introduced for
> each caller. And (2) the size that will be used as the additional
> stopping criteria in the list_for_each_table_entry macro (to be added
> when all the callers are migrated)
> 
> Signed-off-by: Joel Granados <j.granados@xxxxxxxxxxx>
> ---
>  include/linux/sysctl.h | 14 ++++++++++++--
>  1 file changed, 12 insertions(+), 2 deletions(-)
> 
> diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
> index 59d451f455bf..33252ad58ebe 100644
> --- a/include/linux/sysctl.h
> +++ b/include/linux/sysctl.h
> @@ -159,12 +159,22 @@ struct ctl_node {
>       struct ctl_table_header *header;
>  };
>  
> -/* struct ctl_table_header is used to maintain dynamic lists of
> -   struct ctl_table trees. */
> +/**
> + * struct ctl_table_header - maintains dynamic lists of struct ctl_table 
> trees
> + * @ctl_table: pointer to the first element in ctl_table array
> + * @ctl_table_size: number of elements pointed by @ctl_table
> + * @used: The entry will never be touched when equal to 0.
> + * @count: Upped every time something is added to @inodes and downed every 
> time
> + *         something is removed from inodes
> + * @nreg: When nreg drops to 0 the ctl_table_header will be unregistered.
> + * @rcu: Delays the freeing of the inode. Introduced with "unfuck 
> proc_sysctl ->d_compare()"
> + *
> + */

Hi Joel,

Please consider also adding kernel doc entries for the other fields of
struct ctl_table_header. According to ./scripts/kernel-doc -none
they are:

  unregistering
  ctl_table_arg
  root
  set
  parent
  node
  inodes


>  struct ctl_table_header {
>       union {
>               struct {
>                       struct ctl_table *ctl_table;
> +                     int ctl_table_size;
>                       int used;
>                       int count;
>                       int nreg;
> -- 
> 2.30.2
> 

<Prev in Thread] Current Thread [Next in Thread>