use standard sysctl macro
Subsystems (9)
v4 cover use standard sysctl macro
From: Tonghao Zhang <[email protected]>
This patchset introduce sysctl macro or replace var with macro.
Tonghao Zhang (3):
net: sysctl: use shared sysctl macro
net: sysctl: introduce sysctl SYSCTL_THREE selftests/sysctl: add sysctl macro test
fs/proc/proc_sysctl.c | 2 +- include/linux/sysctl.h | 9 ++--- lib/test_sysctl.c | 21 ++++++++++++ net/core/sysctl_net_core.c | 13 +++---- net/ipv4/sysctl_net_ipv4.c | 16 ++++----- net/ipv6/sysctl_net_ipv6.c | 6 ++-- net/netfilter/ipvs/ip_vs_ctl.c | 4 +-- tools/testing/selftests/sysctl/sysctl.sh | 43 ++++++++++++++++++++++++ 8 files changed, 84 insertions(+), 30 deletions(-)
Signature · 24 lines
v4: add selftests/sysctl patch v3: split patch to two. Cc: Luis Chamberlain <[email protected]> Cc: Kees Cook <[email protected]> Cc: Iurii Zaikin <[email protected]> Cc: "David S. Miller" <[email protected]> Cc: Jakub Kicinski <[email protected]> Cc: Paolo Abeni <[email protected]> Cc: Hideaki YOSHIFUJI <[email protected]> Cc: David Ahern <[email protected]> Cc: Simon Horman <[email protected]> Cc: Julian Anastasov <[email protected]> Cc: Pablo Neira Ayuso <[email protected]> Cc: Jozsef Kadlecsik <[email protected]> Cc: Florian Westphal <[email protected]> Cc: Shuah Khan <[email protected]> Cc: Andrew Morton <[email protected]> Cc: Alexei Starovoitov <[email protected]> Cc: Eric Dumazet <[email protected]> Cc: Lorenz Bauer <[email protected]> Cc: Akhmat Karakotov <[email protected]> -- 2.27.0
PATCH v4 1/3 net: sysctl: use shared sysctl macro
From: Tonghao Zhang <[email protected]>
This patch replace two, four and long_one to SYSCTL_XXX.
--- net/core/sysctl_net_core.c | 10 ++++------ net/ipv4/sysctl_net_ipv4.c | 13 +++++-------- net/ipv6/sysctl_net_ipv6.c | 3 +-- 3 files changed, 10 insertions(+), 16 deletions(-)
net/core/sysctl_net_core.c +4 -6
@@ -25,13 +25,11 @@#include "dev.h" -static int two =2 ;static int three =3 ;static int int_3600 =3600 ;static int min_sndbuf =SOCK_MIN_SNDBUF ;static int min_rcvbuf =SOCK_MIN_RCVBUF ;static int max_skb_frags =MAX_SKB_FRAGS ; -static long long_one__maybe_unused =1 ;static long long_max__maybe_unused =LONG_MAX ;static int net_msg_warn;/* Unused, but still a sysctl */
@@ -390,7 +388,7 @@ static struct ctl_table net_core_table[] = { .extra2 = SYSCTL_ONE, # else .extra1 = SYSCTL_ZERO, - .extra2 = &two, + .extra2 = SYSCTL_TWO,# endif },# ifdef CONFIG_HAVE_EBPF_JIT
@@ -401,7 +399,7 @@ static struct ctl_table net_core_table[] = { .mode = 0600, .proc_handler = proc_dointvec_minmax_bpf_restricted, .extra1 = SYSCTL_ZERO, - .extra2 = &two, + .extra2 = SYSCTL_TWO, }, { .procname = "bpf_jit_kallsyms",
@@ -419,7 +417,7 @@ static struct ctl_table net_core_table[] = { .maxlen = sizeof(long), .mode = 0600, .proc_handler = proc_dolongvec_minmax_bpf_restricted, - .extra1 = &long_one, + .extra1 = SYSCTL_LONG_ONE, .extra2 = &bpf_jit_limit_max, },#endif
@@ -546,7 +544,7 @@ static struct ctl_table net_core_table[] = { .mode = 0644, .proc_handler = proc_dointvec_minmax, .extra1 = SYSCTL_ZERO, - .extra2 = &two, + .extra2 = SYSCTL_TWO, }, { .procname = "devconf_inherit_init_net",
net/ipv4/sysctl_net_ipv4.c +5 -8
@@ -20,10 +20,7 @@#include <net/protocol.h> #include <net/netevent.h> -static int two =2 ;static int three__maybe_unused =3 ; -static int four =4 ; -static int thousand =1000 ;static int tcp_retr1_max =255 ;static int ip_local_port_range_min[] = {1 ,1 };static int ip_local_port_range_max[] = {65535 ,65535 };
@@ -1006,7 +1003,7 @@ static struct ctl_table ipv4_net_table[] = { .mode = 0644, .proc_handler = proc_dou8vec_minmax, .extra1 = SYSCTL_ZERO, - .extra2 = &two, + .extra2 = SYSCTL_TWO, }, { .procname = "tcp_max_syn_backlog",
@@ -1117,7 +1114,7 @@ static struct ctl_table ipv4_net_table[] = { .mode = 0644, .proc_handler = proc_dou8vec_minmax, .extra1 = SYSCTL_ZERO, - .extra2 = &four, + .extra2 = SYSCTL_FOUR, }, { .procname = "tcp_recovery",
@@ -1310,7 +1307,7 @@ static struct ctl_table ipv4_net_table[] = { .mode = 0644, .proc_handler = proc_dointvec_minmax, .extra1 = SYSCTL_ZERO, - .extra2 = &thousand, + .extra2 = SYSCTL_ONE_THOUSAND, }, { .procname = "tcp_pacing_ca_ratio",
@@ -1319,7 +1316,7 @@ static struct ctl_table ipv4_net_table[] = { .mode = 0644, .proc_handler = proc_dointvec_minmax, .extra1 = SYSCTL_ZERO, - .extra2 = &thousand, + .extra2 = SYSCTL_ONE_THOUSAND, }, { .procname = "tcp_wmem",
@@ -1391,7 +1388,7 @@ static struct ctl_table ipv4_net_table[] = { .mode = 0644, .proc_handler = proc_dou8vec_minmax, .extra1 = SYSCTL_ZERO, - .extra2 = &two, + .extra2 = SYSCTL_TWO, }, { } };
net/ipv6/sysctl_net_ipv6.c +1 -2
@@ -23,7 +23,6 @@#endif #include <linux/ioam6.h> -static int two =2 ;static int three =3 ;static int flowlabel_reflect_max =0x7 ;static int auto_flowlabels_max =IP6_AUTO_FLOW_LABEL_MAX ;
@@ -197,7 +196,7 @@ static struct ctl_table ipv6_table_template[] = { .mode = 0644, .proc_handler = proc_dou8vec_minmax, .extra1 = SYSCTL_ZERO, - .extra2 = &two, + .extra2 = SYSCTL_TWO, }, { .procname = "ioam6_id",
Signature · 1 line
2.27.0
PATCH v4 2/3 net: sysctl: introduce sysctl SYSCTL_THREE
In reply to [email protected]From: Tonghao Zhang <[email protected]>
This patch introdues the SYSCTL_THREE.
KUnit:
[00:10:14] ================ sysctl_test (10 subtests) ================= [00:10:14] [PASSED] sysctl_test_api_dointvec_null_tbl_data [00:10:14] [PASSED] sysctl_test_api_dointvec_table_maxlen_unset [00:10:14] [PASSED] sysctl_test_api_dointvec_table_len_is_zero [00:10:14] [PASSED] sysctl_test_api_dointvec_table_read_but_position_set [00:10:14] [PASSED] sysctl_test_dointvec_read_happy_single_positive [00:10:14] [PASSED] sysctl_test_dointvec_read_happy_single_negative [00:10:14] [PASSED] sysctl_test_dointvec_write_happy_single_positive [00:10:14] [PASSED] sysctl_test_dointvec_write_happy_single_negative [00:10:14] [PASSED] sysctl_test_api_dointvec_write_single_less_int_min [00:10:14] [PASSED] sysctl_test_api_dointvec_write_single_greater_int_max [00:10:14] =================== [PASSED] sysctl_test ===================
./run_kselftest.sh -c sysctl
...
ok 1 selftests: sysctl: sysctl.sh
--- fs/proc/proc_sysctl.c | 2 +- include/linux/sysctl.h | 9 +++++---- net/core/sysctl_net_core.c | 3 +-- net/ipv4/sysctl_net_ipv4.c | 3 +-- net/ipv6/sysctl_net_ipv6.c | 3 +-- net/netfilter/ipvs/ip_vs_ctl.c | 4 +--- 6 files changed, 10 insertions(+), 14 deletions(-)
fs/proc/proc_sysctl.c +1 -1
@@ -26,7 +26,7 @@ static const struct file_operations proc_sys_dir_file_operations;static const struct inode_operations proc_sys_dir_operations;/* shared constants to be used in various sysctls */ -const int sysctl_vals[] = {-1 ,0 ,1 ,2 ,4 ,100 ,200 ,1000 ,3000 ,INT_MAX ,65535 }; +const int sysctl_vals[] = {0 ,1 ,2 ,3 ,4 ,100 ,200 ,1000 ,3000 ,INT_MAX ,65535 ,-1 };EXPORT_SYMBOL (sysctl_vals);const unsigned long sysctl_long_vals[] = {0 ,1 ,LONG_MAX };
include/linux/sysctl.h +5 -4
@@ -38,10 +38,10 @@ struct ctl_table_header;struct ctl_dir ;/* Keep the same order as in fs/proc/proc_sysctl.c */ -#define SYSCTL_NEG_ONE ((void *)&sysctl_vals[0]) -#define SYSCTL_ZERO ((void *)&sysctl_vals[1]) -#define SYSCTL_ONE ((void *)&sysctl_vals[2]) -#define SYSCTL_TWO ((void *)&sysctl_vals[3]) +#define SYSCTL_ZERO ((void *)&sysctl_vals[0]) +#define SYSCTL_ONE ((void *)&sysctl_vals[1]) +#define SYSCTL_TWO ((void *)&sysctl_vals[2]) +#define SYSCTL_THREE ((void *)&sysctl_vals[3])#define SYSCTL_FOUR ((void *)&sysctl_vals[4])#define SYSCTL_ONE_HUNDRED ((void *)&sysctl_vals[5])#define SYSCTL_TWO_HUNDRED ((void *)&sysctl_vals[6])
@@ -51,6 +51,7 @@ struct ctl_dir;/* this is needed for the proc_dointvec_minmax for [fs_]overflow UID and GID */ #define SYSCTL_MAXOLDUID ((void *)&sysctl_vals[10]) +#define SYSCTL_NEG_ONE ((void *)&sysctl_vals[11])extern const int sysctl_vals[];
net/core/sysctl_net_core.c +1 -2
@@ -25,7 +25,6 @@#include "dev.h" -static int three =3 ;static int int_3600 =3600 ;static int min_sndbuf =SOCK_MIN_SNDBUF ;static int min_rcvbuf =SOCK_MIN_RCVBUF ;
@@ -553,7 +552,7 @@ static struct ctl_table net_core_table[] = { .mode = 0644, .proc_handler = proc_dointvec_minmax, .extra1 = SYSCTL_ZERO, - .extra2 = &three, + .extra2 = SYSCTL_THREE, }, { .procname = "high_order_alloc_disable",
net/ipv4/sysctl_net_ipv4.c +1 -2
@@ -20,7 +20,6 @@#include <net/protocol.h> #include <net/netevent.h> -static int three__maybe_unused =3 ;static int tcp_retr1_max =255 ;static int ip_local_port_range_min[] = {1 ,1 };static int ip_local_port_range_max[] = {65535 ,65535 };
@@ -1056,7 +1055,7 @@ static struct ctl_table ipv4_net_table[] = { .mode = 0644, .proc_handler = proc_fib_multipath_hash_policy, .extra1 = SYSCTL_ZERO, - .extra2 = &three, + .extra2 = SYSCTL_THREE, }, { .procname = "fib_multipath_hash_fields",
net/ipv6/sysctl_net_ipv6.c +1 -2
@@ -23,7 +23,6 @@#endif #include <linux/ioam6.h> -static int three =3 ;static int flowlabel_reflect_max =0x7 ;static int auto_flowlabels_max =IP6_AUTO_FLOW_LABEL_MAX ; static u32 rt6_multipath_hash_fields_all_mask =
@@ -171,7 +170,7 @@ static struct ctl_table ipv6_table_template[] = { .mode = 0644, .proc_handler = proc_rt6_multipath_hash_policy, .extra1 = SYSCTL_ZERO, - .extra2 = &three, + .extra2 = SYSCTL_THREE, }, { .procname = "fib_multipath_hash_fields",
net/netfilter/ipvs/ip_vs_ctl.c +1 -3
@@ -1767,8 +1767,6 @@ static int ip_vs_zero_all(struct netns_ipvs *ipvs)#ifdef CONFIG_SYSCTL -static int three =3 ; -static int proc_do_defense_mode (struct ctl_table *table,int write,void *buffer,size_t *lenp,loff_t *ppos)
@@ -1977,7 +1975,7 @@ static struct ctl_table vs_vars[] = { .mode = 0644, .proc_handler = proc_dointvec_minmax, .extra1 = SYSCTL_ZERO, - .extra2 = &three, + .extra2 = SYSCTL_THREE, }, { .procname = "nat_icmp_send",
Signature · 1 line
2.27.0
PATCH v4 3/3 selftests/sysctl: add sysctl macro test
In reply to [email protected]From: Tonghao Zhang <[email protected]>
--- lib/test_sysctl.c | 21 ++++++++++++ tools/testing/selftests/sysctl/sysctl.sh | 43 ++++++++++++++++++++++++ 2 files changed, 64 insertions(+)
lib/test_sysctl.c +21 -0
@@ -43,6 +43,7 @@ struct test_sysctl_data {int int_0001;int int_0002;int int_0003[4 ]; +int match_int[12 ];int boot_int;
@@ -95,6 +96,13 @@ static struct ctl_table test_table[] = { .mode = 0644, .proc_handler = proc_dointvec, }, + { + .procname = "match_int", + .data = &test_data.match_int, + .maxlen = sizeof(test_data.match_int), + .mode = 0444, + .proc_handler = proc_dointvec, + }, { .procname = "boot_int", .data = &test_data.boot_int,
@@ -132,6 +140,19 @@ static struct ctl_table_header *test_sysctl_header;static int __init test_sysctl_init (void ) { + test_data.match_int[0 ] = *(int *)SYSCTL_ZERO , + test_data.match_int[1 ] = *(int *)SYSCTL_ONE , + test_data.match_int[2 ] = *(int *)SYSCTL_TWO , + test_data.match_int[3 ] = *(int *)SYSCTL_THREE , + test_data.match_int[4 ] = *(int *)SYSCTL_FOUR , + test_data.match_int[5 ] = *(int *)SYSCTL_ONE_HUNDRED , + test_data.match_int[6 ] = *(int *)SYSCTL_TWO_HUNDRED , + test_data.match_int[7 ] = *(int *)SYSCTL_ONE_THOUSAND , + test_data.match_int[8 ] = *(int *)SYSCTL_THREE_THOUSAND , + test_data.match_int[9 ] = *(int *)SYSCTL_INT_MAX , + test_data.match_int[10 ] = *(int *)SYSCTL_MAXOLDUID , + test_data.match_int[11 ] = *(int *)SYSCTL_NEG_ONE , + test_data.bitmap_0001 =kzalloc (SYSCTL_TEST_BITMAP_SIZE /8 ,GFP_KERNEL );if (!test_data.bitmap_0001)return -ENOMEM ;
tools/testing/selftests/sysctl/sysctl.sh +43 -0
61 lines not on this page · raw message
Signature · 1 line
2.27.0
Jakub Kicinski
maintainerRe: [net-next v4 3/3] selftests/sysctl: add sysctl macro test
Quoted 6 lines · On Fri, 22 Apr 2022 15:01:41 +0800 [email protected] wrote:
static int
__inittest_sysctl_init(void)
{lib/test_sysctl.c +4
-0+ test_data.match_int[0 ] = *(int *)SYSCTL_ZERO , + test_data.match_int[1 ] = *(int *)SYSCTL_ONE , + test_data.match_int[2 ] = *(int *)SYSCTL_TWO , + test_data.match_int[3] = *(int *)SYSCTL_THREE,
lib/test_sysctl.c static struct ctl_table_header *test_sysctl_header;
Quoted 10 lines
lib/test_sysctl.c +9
-0+ test_data.match_int[4 ] = *(int *)SYSCTL_FOUR , + test_data.match_int[5 ] = *(int *)SYSCTL_ONE_HUNDRED , + test_data.match_int[6 ] = *(int *)SYSCTL_TWO_HUNDRED , + test_data.match_int[7 ] = *(int *)SYSCTL_ONE_THOUSAND , + test_data.match_int[8 ] = *(int *)SYSCTL_THREE_THOUSAND , + test_data.match_int[9 ] = *(int *)SYSCTL_INT_MAX , + test_data.match_int[10 ] = *(int *)SYSCTL_MAXOLDUID , + test_data.match_int[11 ] = *(int *)SYSCTL_NEG_ONE , + local VALUES=(0 1 2 3 4 100 200 1000 3000 $INT_MAX 65535 -1)
How does this test work? Am I reading it right that it checks if this bash array is in sync with the kernel code?
I'd be better if we were checking the values of the constants against literals / defines.
Re: [net-next v4 3/3] selftests/sysctl: add sysctl macro test
Quoted 17 lines · Jakub Kicinski
Quoted 14 lines · On Fri, 22 Apr 2022 15:01:41 +0800 [email protected] wrote:
static int
__inittest_sysctl_init(void)
{lib/test_sysctl.c +12
-0+ test_data.match_int[0 ] = *(int *)SYSCTL_ZERO , + test_data.match_int[1 ] = *(int *)SYSCTL_ONE , + test_data.match_int[2 ] = *(int *)SYSCTL_TWO , + test_data.match_int[3 ] = *(int *)SYSCTL_THREE , + test_data.match_int[4 ] = *(int *)SYSCTL_FOUR , + test_data.match_int[5 ] = *(int *)SYSCTL_ONE_HUNDRED , + test_data.match_int[6 ] = *(int *)SYSCTL_TWO_HUNDRED , + test_data.match_int[7 ] = *(int *)SYSCTL_ONE_THOUSAND , + test_data.match_int[8 ] = *(int *)SYSCTL_THREE_THOUSAND , + test_data.match_int[9 ] = *(int *)SYSCTL_INT_MAX , + test_data.match_int[10 ] = *(int *)SYSCTL_MAXOLDUID , + test_data.match_int[11] = *(int *)SYSCTL_NEG_ONE,
Quoted 4 lines
Quoted 1 line
+ local VALUES=(0 1 2 3 4 100 200 1000 3000 $INT_MAX 65535 -1)
How does this test work? Am I reading it right that it checks if this bash array is in sync with the kernel code?
This patch tries to avoid SYSCTL_XXX not mapping the values we hoped, when introducing the new SYSCTL_YYY.
for example:SYSCTL_TWO, we hope it is 2, so we check it in userspace.
Quoted 2 lines
I'd be better if we were checking the values of the constants against literals / defines.
Hi Jakub, I think this patch checks the values of the constants against defines. But I should make the codes more readable
static int __init test_sysctl_init(void)
{
+ int i;
+
+ struct {
+ int defined;
+ int wanted;
+ } match_int[] = {
+ {.defined = *(int *)SYSCTL_ZERO, .wanted = 0},
+ {.defined = *(int *)SYSCTL_ONE, .wanted = 1},
+ {.defined = *(int *)SYSCTL_TWO, .wanted = 2},
+ {.defined = *(int *)SYSCTL_THREE, .wanted = 3},
+ {.defined = *(int *)SYSCTL_FOUR, .wanted = 4},
+ {.defined = *(int *)SYSCTL_ONE_HUNDRED, .wanted = 100},
+ {.defined = *(int *)SYSCTL_TWO_HUNDRED, .wanted = 200},
+ {.defined = *(int *)SYSCTL_ONE_THOUSAND, .wanted = 1000},
+ {.defined = *(int *)SYSCTL_THREE_THOUSAND, .wanted = 3000},
+ {.defined = *(int *)SYSCTL_INT_MAX, .wanted = INT_MAX},
+ {.defined = *(int *)SYSCTL_MAXOLDUID, .wanted = 65535},
+ {.defined = *(int *)SYSCTL_NEG_ONE, .wanted = -1},+ };
+
+ for (i = 0; i < ARRAY_SIZE(match_int); i++)
+ if (match_int[i].defined != match_int[i].wanted)
+ match_int_ok = 0;
+
--
Best regards, Tonghao
Jakub Kicinski
maintainerRe: [net-next v4 3/3] selftests/sysctl: add sysctl macro test
Review
Quoted 4 lines · On Sun, 1 May 2022 11:31:47 +0800 Tonghao Zhang wrote:
static int
__inittest_sysctl_init(void)
{(quoted diff) +2
-0+ int i; +
nit: No empty line needed here.
Quoted 11 lines
(quoted diff) +11
-0+ struct { + int defined; + int wanted; + } match_int[] = { + {.defined = *(int *)SYSCTL_ZERO, .wanted = 0}, + {.defined = *(int *)SYSCTL_ONE, .wanted = 1}, + {.defined = *(int *)SYSCTL_TWO, .wanted = 2}, + {.defined = *(int *)SYSCTL_THREE, .wanted = 3}, + {.defined = *(int *)SYSCTL_FOUR, .wanted = 4}, + {.defined = *(int *)SYSCTL_ONE_HUNDRED, .wanted = 100}, + {.defined = *(int *)SYSCTL_TWO_HUNDRED, .wanted = 200},
Review
Quoted 10 lines
(quoted diff) +10
-0+ {.defined = *(int *)SYSCTL_ONE_THOUSAND, .wanted = 1000}, + {.defined = *(int *)SYSCTL_THREE_THOUSAND, .wanted = 3000}, + {.defined = *(int *)SYSCTL_INT_MAX, .wanted = INT_MAX}, + {.defined = *(int *)SYSCTL_MAXOLDUID, .wanted = 65535}, + {.defined = *(int *)SYSCTL_NEG_ONE, .wanted = -1}, + }; + + for (i = 0; i < ARRAY_SIZE(match_int); i++) + if (match_int[i].defined != match_int[i].wanted) + match_int_ok = 0;
That's better, thank you!
Quoted 9 lines · On Fri, Apr 22, 2022 at 03:01:38PM +0800, [email protected] wrote:
From: Tonghao Zhang <[email protected]>
This patchset introduce sysctl macro or replace var with macro.
Tonghao Zhang (3):
net: sysctl: use shared sysctl macro
net: sysctl: introduce sysctlSYSCTL_THREE
selftests/sysctl: add sysctl macro test
I see these are based on net-next, to avoid conflicts with sysctl development this may be best based on sysctl-next though. Jakub?
Luis
Jakub Kicinski
maintainerQuoted 6 lines · On Fri, 22 Apr 2022 07:44:12 -0700 Luis Chamberlain wrote:
Quoted 5 lines · On Fri, Apr 22, 2022 at 03:01:38PM +0800, [email protected] wrote:
From: Tonghao Zhang <[email protected]>
This patchset introduce sysctl macro or replace var with macro.
Quoted 8 lines
Quoted 4 lines
Tonghao Zhang (3):
net: sysctl: use shared sysctl macro
net: sysctl: introduce sysctlSYSCTL_THREE
selftests/sysctl: add sysctl macro testI see these are based on net-next, to avoid conflicts with sysctl development this may be best based on sysctl-next though. Jakub?
I guess the base should be whatever we are going to use as a base for a branch, the branch we can both pull in?
How many patches like that do you see flying around, tho? I feel like I've seen at least 3 - netfilter, net core and bpf. It's starting to feel like we should have one patch that adds all the constants and self test, put that in a branch anyone can pull in, and then do the conversions in separate patches..
Option number two - rename the statics in the subsystems to SYSCTL_x, and we can do a much smaller cleanup in the next cycle which would replace those with a centralized instances? That should have minimal chance of conflicts so no need to do special branches.
Option number three defer all this until the merge window.
Quoted 25 lines · Jakub Kicinski
Quoted 6 lines · On Fri, 22 Apr 2022 07:44:12 -0700 Luis Chamberlain wrote:
Quoted 5 lines · On Fri, Apr 22, 2022 at 03:01:38PM +0800, [email protected] wrote:
From: Tonghao Zhang <[email protected]>
This patchset introduce sysctl macro or replace var with macro.
Quoted 8 lines
Quoted 4 lines
Tonghao Zhang (3):
net: sysctl: use shared sysctl macro
net: sysctl: introduce sysctlSYSCTL_THREE
selftests/sysctl: add sysctl macro testI see these are based on net-next, to avoid conflicts with sysctl development this may be best based on sysctl-next though. Jakub?
I guess the base should be whatever we are going to use as a base for a branch, the branch we can both pull in?
How many patches like that do you see flying around, tho? I feel like I've seen at least 3 - netfilter, net core and bpf. It's starting to feel like we should have one patch that adds all the constants and self test, put that in a branch anyone can pull in, and then do the conversions in separate patches..
Quoted 6 lines
Option number two - rename the statics in the subsystems to
SYSCTL_x, and we can do a much smaller cleanup in the next cycle which would replace those with a centralized instances? That should have minimal chance of conflicts so no need to do special branches.Option number three defer all this until the merge window.
I have a better option. I checked to see the diff stat between the proposed patch to see what the chances of a conflict are and so far I don't see any conflict so I think this patchset should just go through your tree.
So feel free to take it in! Let me know if that's OK!
The proposed pathset diffstat:
fs/proc/proc_sysctl.c | 2 +- include/linux/sysctl.h | 9 ++--- lib/test_sysctl.c | 21 ++++++++++++ net/core/sysctl_net_core.c | 13 +++---- net/ipv4/sysctl_net_ipv4.c | 16 ++++----- net/ipv6/sysctl_net_ipv6.c | 6 ++-- net/netfilter/ipvs/ip_vs_ctl.c | 4 +-- tools/testing/selftests/sysctl/sysctl.sh | 43 ++++++++++++++++++++++++ 8 files changed, 84 insertions(+), 30 deletions(-)
The sysctl-next diff stat:
fs/proc/proc_sysctl.c | 88 ++++++----- include/linux/acct.h | 1 - include/linux/delayacct.h | 3 - include/linux/ftrace.h | 3 - include/linux/initrd.h | 2 - include/linux/latencytop.h | 3 - include/linux/lockdep.h | 4 - include/linux/oom.h | 4 - include/linux/panic.h | 6 - include/linux/reboot.h | 4 - include/linux/sched/sysctl.h | 41 ----- include/linux/writeback.h | 15 -- init/do_mounts_initrd.c | 22 ++- kernel/acct.c | 22 ++- kernel/bpf/syscall.c | 87 ++++++++++ kernel/delayacct.c | 22 ++- kernel/latencytop.c | 41 +++-- kernel/locking/lockdep.c | 35 ++++- kernel/panic.c | 26 ++- kernel/rcu/rcu.h | 2 + kernel/reboot.c | 34 +++- kernel/sched/core.c | 69 +++++--- kernel/sched/deadline.c | 42 ++++- kernel/sched/fair.c | 32 +++- kernel/sched/rt.c | 63 +++++++- kernel/sched/sched.h | 7 + kernel/sched/topology.c | 25 ++- kernel/sysctl.c | 366 ------------------------------------------- kernel/trace/ftrace.c | 101 +++++++----- mm/oom_kill.c | 38 ++++- mm/page-writeback.c | 104 ++++++++++-- 31 files changed, 718 insertions(+), 594 deletions(-)
Luis
Jakub Kicinski
maintainerQuoted 6 lines · On Mon, 25 Apr 2022 12:47:06 -0700 Luis Chamberlain wrote:
I have a better option. I checked to see the diff stat between the proposed patch to see what the chances of a conflict are and so far I don't see any conflict so I think this patchset should just go through your tree.
So feel free to take it in! Let me know if that's OK!
Ok, assuming the netfilter and bpf patches I saw were the only other conversions we can resolve the conflicts before code reaches Linus...
Quoted 10 lines · Jakub Kicinski
Quoted 6 lines · On Mon, 25 Apr 2022 12:47:06 -0700 Luis Chamberlain wrote:
I have a better option. I checked to see the diff stat between the proposed patch to see what the chances of a conflict are and so far I don't see any conflict so I think this patchset should just go through your tree.
So feel free to take it in! Let me know if that's OK!
Ok, assuming the netfilter and bpf patches I saw were the only other conversions we can resolve the conflicts before code reaches Linus...
Sure thing.
Luis