[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200529070903.GV11244@42.do-not-panic.com>
Date: Fri, 29 May 2020 07:09:03 +0000
From: Luis Chamberlain <mcgrof@...nel.org>
To: Xiaoming Ni <nixiaoming@...wei.com>
Cc: keescook@...omium.org, yzaikin@...gle.com, adobriyan@...il.com,
mingo@...nel.org, gpiccoli@...onical.com, rdna@...com,
patrick.bellasi@....com, sfr@...b.auug.org.au,
akpm@...ux-foundation.org, mhocko@...e.com,
penguin-kernel@...ove.sakura.ne.jp, vbabka@...e.cz,
tglx@...utronix.de, peterz@...radead.org,
Jisheng.Zhang@...aptics.com, khlebnikov@...dex-team.ru,
bigeasy@...utronix.de, pmladek@...e.com,
linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org,
wangle6@...wei.com, alex.huangjianhui@...wei.com
Subject: Re: [PATCH v4 1/4] sysctl: Add register_sysctl_init() interface
On Tue, May 19, 2020 at 11:31:08AM +0800, Xiaoming Ni wrote:
> --- a/kernel/sysctl.c
> +++ b/kernel/sysctl.c
> @@ -3358,6 +3358,25 @@ int __init sysctl_init(void)
> kmemleak_not_leak(hdr);
> return 0;
> }
> +
> +/*
> + * The sysctl interface is used to modify the interface value,
> + * but the feature interface has default values. Even if register_sysctl fails,
> + * the feature body function can also run. At the same time, malloc small
> + * fragment of memory during the system initialization phase, almost does
> + * not fail. Therefore, the function return is designed as void
> + */
Let's use kdoc while at it. Can you convert this to proper kdoc?
> +void __init register_sysctl_init(const char *path, struct ctl_table *table,
> + const char *table_name)
> +{
> + struct ctl_table_header *hdr = register_sysctl(path, table);
> +
> + if (unlikely(!hdr)) {
> + pr_err("failed when register_sysctl %s to %s\n", table_name, path);
> + return;
table_name is only used for this, however we can easily just make
another _register_sysctl_init() helper first, and then use a macro
which will concatenate this to something useful if you want to print
a string. I see no point in the description for this, specially since
the way it was used was not to be descriptive, but instead just a name
followed by some underscore and something else.
> + }
> + kmemleak_not_leak(hdr);
Is it *wrong* to run kmemleak_not_leak() when hdr was not allocated?
If so, can you fix the sysctl __init call itself?
PS. Since you have given me your series, feel free to send me a patch
as a follow up to this in privae and I can integrate it into my tree.
Luis
Powered by blists - more mailing lists