From: Oleg Nesterov <oleg@redhat.com>
To: Joel Granados <joel.granados@kernel.org>
Cc: Mark Brown <broonie@kernel.org>,
Luis Chamberlain <mcgrof@kernel.org>,
Sudip Mukherjee <sudipm.mukherjee@gmail.com>,
Alexander Viro <viro@zeniv.linux.org.uk>,
Christian Brauner <brauner@kernel.org>, Jan Kara <jack@suse.cz>,
Kees Cook <kees@kernel.org>,
linux-kernel@vger.kernel.org
Subject: [PATCH sysctl-next 1/2] sysctl: collapse redundant CONFIG_SYSCTL nesting in kernel/sysctl.c
Date: Fri, 7 Aug 2026 17:47:44 +0200 [thread overview]
Message-ID: <anX-II_sAoJQy83X@redhat.com> (raw)
After the removal of CONFIG_PROC_SYSCTL, several #ifdef CONFIG_SYSCTL
blocks ended up nested inside the outer (now the same) CONFIG_SYSCTL
guards.
Collapse them and remove a now-stale "/proc/sys support" comment which
referred to CONFIG_PROC_SYSCTL.
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
---
kernel/sysctl.c | 16 ++--------------
1 file changed, 2 insertions(+), 14 deletions(-)
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index f7b75985d542..d0a612c65b08 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -29,14 +29,12 @@ EXPORT_SYMBOL(sysctl_vals);
const unsigned long sysctl_long_vals[] = { 0, 1, LONG_MAX };
EXPORT_SYMBOL_GPL(sysctl_long_vals);
-#if defined(CONFIG_SYSCTL)
+#ifdef CONFIG_SYSCTL
/* Constants used for minimum and maximum */
static const int ngroups_max = NGROUPS_MAX;
static const int cap_last_cap = CAP_LAST_CAP;
-#ifdef CONFIG_SYSCTL
-
/**
* enum sysctl_writes_mode - supported sysctl write modes
*
@@ -64,14 +62,6 @@ enum sysctl_writes_mode {
};
static enum sysctl_writes_mode sysctl_writes_strict = SYSCTL_WRITES_STRICT;
-#endif /* CONFIG_SYSCTL */
-#endif /* CONFIG_SYSCTL */
-
-/*
- * /proc/sys support
- */
-
-#ifdef CONFIG_SYSCTL
static int _proc_do_string(char *data, int maxlen, int dir,
char *buffer, size_t *lenp, loff_t *ppos)
@@ -1366,7 +1356,7 @@ int proc_do_large_bitmap(const struct ctl_table *table, int dir,
#endif /* CONFIG_SYSCTL */
-#if defined(CONFIG_SYSCTL)
+#ifdef CONFIG_SYSCTL
int proc_do_static_key(const struct ctl_table *table, int dir,
void *buffer, size_t *lenp, loff_t *ppos)
{
@@ -1398,7 +1388,6 @@ int proc_do_static_key(const struct ctl_table *table, int dir,
}
static const struct ctl_table sysctl_subsys_table[] = {
-#ifdef CONFIG_SYSCTL
{
.procname = "sysctl_writes_strict",
.data = &sysctl_writes_strict,
@@ -1408,7 +1397,6 @@ static const struct ctl_table sysctl_subsys_table[] = {
.extra1 = SYSCTL_NEG_ONE,
.extra2 = SYSCTL_ONE,
},
-#endif
{
.procname = "ngroups_max",
.data = (void *)&ngroups_max,
base-commit: 8d75c338f0bcecaa6c9af67f86c176b67b6acf3e
--
2.52.0
next reply other threads:[~2026-08-07 15:48 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-07 15:47 Oleg Nesterov [this message]
2026-08-07 15:48 ` [PATCH sysctl-next 2/2] sysctl: remove redundant CONFIG_PROC_FS checks Oleg Nesterov
2026-08-07 18:01 ` Bradley Morgan
2026-08-07 17:16 ` [PATCH sysctl-next 1/2] sysctl: collapse redundant CONFIG_SYSCTL nesting in kernel/sysctl.c Bradley Morgan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=anX-II_sAoJQy83X@redhat.com \
--to=oleg@redhat.com \
--cc=brauner@kernel.org \
--cc=broonie@kernel.org \
--cc=jack@suse.cz \
--cc=joel.granados@kernel.org \
--cc=kees@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mcgrof@kernel.org \
--cc=sudipm.mukherjee@gmail.com \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox