LVS
lvs-devel
Google
 
Web LinuxVirtualServer.org

Re: [PATCH net-next v6 0/8] sysctl: Remove sentinel elements from networ

To: j.granados@xxxxxxxxxxx
Subject: Re: [PATCH net-next v6 0/8] sysctl: Remove sentinel elements from networking
Cc: "David S. Miller" <davem@xxxxxxxxxxxxx>, Eric Dumazet <edumazet@xxxxxxxxxx>, Jakub Kicinski <kuba@xxxxxxxxxx>, Paolo Abeni <pabeni@xxxxxxxxxx>, Alexander Aring <alex.aring@xxxxxxxxx>, Stefan Schmidt <stefan@xxxxxxxxxxxxxxxxxx>, Miquel Raynal <miquel.raynal@xxxxxxxxxxx>, David Ahern <dsahern@xxxxxxxxxx>, Steffen Klassert <steffen.klassert@xxxxxxxxxxx>, Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>, Matthieu Baerts <matttbe@xxxxxxxxxx>, Mat Martineau <martineau@xxxxxxxxxx>, Geliang Tang <geliang@xxxxxxxxxx>, Remi Denis-Courmont <courmisch@xxxxxxxxx>, Allison Henderson <allison.henderson@xxxxxxxxxx>, David Howells <dhowells@xxxxxxxxxx>, Marc Dionne <marc.dionne@xxxxxxxxxxxx>, Marcelo Ricardo Leitner <marcelo.leitner@xxxxxxxxx>, Xin Long <lucien.xin@xxxxxxxxx>, Wenjia Zhang <wenjia@xxxxxxxxxxxxx>, Jan Karcher <jaka@xxxxxxxxxxxxx>, "D. Wythe" <alibuda@xxxxxxxxxxxxxxxxx>, Tony Lu <tonylu@xxxxxxxxxxxxxxxxx>, Wen Gu <guwen@xxxxxxxxxxxxxxxxx>, Trond Myklebust <trond.myklebust@xxxxxxxxxxxxxxx>, Anna Schumaker <anna@xxxxxxxxxx>, Chuck Lever <chuck.lever@xxxxxxxxxx>, Jeff Layton <jlayton@xxxxxxxxxx>, Neil Brown <neilb@xxxxxxx>, Olga Kornievskaia <kolga@xxxxxxxxxx>, Dai Ngo <Dai.Ngo@xxxxxxxxxx>, Tom Talpey <tom@xxxxxxxxxx>, Jon Maloy <jmaloy@xxxxxxxxxx>, Ying Xue <ying.xue@xxxxxxxxxxxxx>, Martin Schiller <ms@xxxxxxxxxx>, Pablo Neira Ayuso <pablo@xxxxxxxxxxxxx>, Jozsef Kadlecsik <kadlec@xxxxxxxxxxxxx>, Florian Westphal <fw@xxxxxxxxx>, Roopa Prabhu <roopa@xxxxxxxxxx>, Nikolay Aleksandrov <razor@xxxxxxxxxxxxx>, Simon Horman <horms@xxxxxxxxxxxx>, Julian Anastasov <ja@xxxxxx>, Joerg Reuter <jreuter@xxxxxxxx>, Luis Chamberlain <mcgrof@xxxxxxxxxx>, Kees Cook <keescook@xxxxxxxxxxxx>, netdev@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx, dccp@xxxxxxxxxxxxxxx, linux-wpan@xxxxxxxxxxxxxxx, mptcp@xxxxxxxxxxxxxxx, linux-hams@xxxxxxxxxxxxxxx, linux-rdma@xxxxxxxxxxxxxxx, rds-devel@xxxxxxxxxxxxxx, linux-afs@xxxxxxxxxxxxxxxxxxx, linux-sctp@xxxxxxxxxxxxxxx, linux-s390@xxxxxxxxxxxxxxx, linux-nfs@xxxxxxxxxxxxxxx, tipc-discussion@xxxxxxxxxxxxxxxxxxxxx, linux-x25@xxxxxxxxxxxxxxx, netfilter-devel@xxxxxxxxxxxxxxx, coreteam@xxxxxxxxxxxxx, bridge@xxxxxxxxxxxxxxx, lvs-devel@xxxxxxxxxxxxxxx
From: Sabrina Dubroca <sd@xxxxxxxxxxxxxxx>
Date: Wed, 1 May 2024 15:22:08 +0200
2024-05-01, 11:29:24 +0200, Joel Granados via B4 Relay wrote:
> From: Joel Granados <j.granados@xxxxxxxxxxx>
> 
> What?
> These commits remove the sentinel element (last empty element) from the
> sysctl arrays of all the files under the "net/" directory that register
> a sysctl array. The merging of the preparation patches [4] to mainline
> allows us to just remove sentinel elements without changing behavior.
> This is safe because the sysctl registration code (register_sysctl() and
> friends) use the array size in addition to checking for a sentinel [1].
> 
> Why?
> By removing the sysctl sentinel elements we avoid kernel bloat as
> ctl_table arrays get moved out of kernel/sysctl.c into their own
> respective subsystems. This move was started long ago to avoid merge
> conflicts; the sentinel removal bit came after Mathew Wilcox suggested
> it to avoid bloating the kernel by one element as arrays moved out. This
> patchset will reduce the overall build time size of the kernel and run
> time memory bloat by about ~64 bytes per declared ctl_table array (more
> info here [5]).
> 
> When are we done?
> There are 4 patchest (25 commits [2]) that are still outstanding to
> completely remove the sentinels: files under "net/" (this patchset),
> files under "kernel/" dir, misc dirs (files under mm/ security/ and
> others) and the final set that removes the unneeded check for ->procname
> == NULL.
> 
> Testing:
> * Ran sysctl selftests (./tools/testing/selftests/sysctl/sysctl.sh)
> * Ran this through 0-day with no errors or warnings
> 
> Savings in vmlinux:
>   A total of 64 bytes per sentinel is saved after removal; I measured in
>   x86_64 to give an idea of the aggregated savings. The actual savings
>   will depend on individual kernel configuration.
>     * bloat-o-meter
>         - The "yesall" config saves 3976 bytes (bloat-o-meter output [6])
>         - A reduced config [3] saves 1263 bytes (bloat-o-meter output [7])
> 
> Savings in allocated memory:
>   None in this set but will occur when the superfluous allocations are
>   removed from proc_sysctl.c. I include it here for context. The
>   estimated savings during boot for config [3] are 6272 bytes. See [8]
>   for how to measure it.
> 
> Comments/feedback greatly appreciated
> 
> Changes in v6:
> - Rebased onto net-next/main.
> - Besides re-running my cocci scripts, I ran a new find script [9].
>   Found 0 hits in net/
> - Moved "i" variable declaraction out of for() in sysctl_core_net_init
> - Removed forgotten sentinel in mpls_table
> - Removed CONFIG_AX25_DAMA_SLAVE guard from net/ax25/ax25_ds_timer.c. It
>   is not needed because that file is compiled only when
>   CONFIG_AX25_DAMA_SLAVE is set.
> - When traversing smc_table, stop on ARRAY_SIZE instead of ARRAY_SIZE-1.
> - Link to v5: 
> https://lore.kernel.org/r/20240426-jag-sysctl_remset_net-v5-0-e3b12f6111a6@xxxxxxxxxxx

I pointed out a few tiny details in the ax25 patch but either way, the
series looks good to me. Thanks!

Series:
Reviewed-by: Sabrina Dubroca <sd@xxxxxxxxxxxxxxx>

Note that you could have kept the ack/reviewed-by on patch 4 since it
was not modified. Jeff and Chuck, your reviews got lost in the repost.

-- 
Sabrina



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