From: Oleg Nesterov <oleg@redhat.com>
To: Allison Henderson <achender@kernel.org>,
Joel Granados <joel.granados@kernel.org>
Cc: pabeni@redhat.com, edumazet@google.com, kuba@kernel.org,
horms@kernel.org, netdev@vger.kernel.org,
linux-rdma@vger.kernel.org
Subject: [PATCH 2/5] net/rds/ib_sysctl.c: move sysctl-only code under CONFIG_SYSCTL
Date: Sat, 24 Oct 2026 17:40:56 +0200 [thread overview]
Message-ID: <atzRiBWrLVTMSrpn@redhat.com> (raw)
In-Reply-To: <atzRTslzb6CAKPKX@redhat.com>
Collect all code used only when CONFIG_SYSCTL=y into a single block and
wrap it in #ifdef CONFIG_SYSCTL. rds_ib_sysctl_init() no longer needs the
IS_ENABLED() check.
Add the corresponding init/exit stubs for the CONFIG_SYSCTL=n case.
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
---
net/rds/ib_sysctl.c | 33 +++++++++++++++++++++++----------
1 file changed, 23 insertions(+), 10 deletions(-)
diff --git a/net/rds/ib_sysctl.c b/net/rds/ib_sysctl.c
index bc97a3eecad6..0b336ff03ae9 100644
--- a/net/rds/ib_sysctl.c
+++ b/net/rds/ib_sysctl.c
@@ -36,19 +36,10 @@
#include "ib.h"
-static struct ctl_table_header *rds_ib_sysctl_hdr;
-
unsigned long rds_ib_sysctl_max_send_wr = RDS_IB_DEFAULT_SEND_WR;
unsigned long rds_ib_sysctl_max_recv_wr = RDS_IB_DEFAULT_RECV_WR;
unsigned long rds_ib_sysctl_max_recv_allocation = (128 * 1024 * 1024) / RDS_FRAG_SIZE;
-static unsigned long rds_ib_sysctl_max_wr_min = 1;
-/* hardware will fail CQ creation long before this */
-static unsigned long rds_ib_sysctl_max_wr_max = (u32)~0;
-
unsigned long rds_ib_sysctl_max_unsig_wrs = 16;
-static unsigned long rds_ib_sysctl_max_unsig_wr_min = 1;
-static unsigned long rds_ib_sysctl_max_unsig_wr_max = 64;
-
/*
* This sysctl does nothing.
*
@@ -61,6 +52,14 @@ static unsigned long rds_ib_sysctl_max_unsig_wr_max = 64;
*/
unsigned int rds_ib_sysctl_flow_control = 0;
+#ifdef CONFIG_SYSCTL
+static unsigned long rds_ib_sysctl_max_wr_min = 1;
+/* hardware will fail CQ creation long before this */
+static unsigned long rds_ib_sysctl_max_wr_max = (u32)~0;
+
+static unsigned long rds_ib_sysctl_max_unsig_wr_min = 1;
+static unsigned long rds_ib_sysctl_max_unsig_wr_max = 64;
+
static struct ctl_table rds_ib_sysctl_table[] = {
{
.procname = "max_send_wr",
@@ -105,6 +104,8 @@ static struct ctl_table rds_ib_sysctl_table[] = {
},
};
+static struct ctl_table_header *rds_ib_sysctl_hdr;
+
void rds_ib_sysctl_exit(void)
{
if (rds_ib_sysctl_hdr)
@@ -114,7 +115,19 @@ void rds_ib_sysctl_exit(void)
int rds_ib_sysctl_init(void)
{
rds_ib_sysctl_hdr = register_net_sysctl(&init_net, "net/rds/ib", rds_ib_sysctl_table);
- if (!rds_ib_sysctl_hdr && IS_ENABLED(CONFIG_SYSCTL))
+ if (!rds_ib_sysctl_hdr)
return -ENOMEM;
return 0;
}
+
+#else
+
+int rds_ib_sysctl_init(void)
+{
+ return 0;
+}
+
+void rds_ib_sysctl_exit(void)
+{
+}
+#endif
--
2.55.0
next prev parent reply other threads:[~2026-10-24 15:41 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-24 15:39 [PATCH 0/5] net/rds: move sysctl-only code under CONFIG_SYSCTL Oleg Nesterov
2026-10-24 15:40 ` [PATCH 1/5] net/rds/sysctl.c: " Oleg Nesterov
2026-10-24 15:40 ` Oleg Nesterov [this message]
2026-10-24 15:40 ` [PATCH 3/5] net/rds/tcp.c: introduce rds_tcp_{init,exit}_net_sysctl() helpers Oleg Nesterov
2026-10-24 15:41 ` [PATCH 4/5] net/rds/tcp.c: move sysctl-only code under CONFIG_SYSCTL Oleg Nesterov
2026-10-24 15:41 ` [PATCH 5/5] net/rds: remove dead sysctl declarations Oleg Nesterov
2026-10-26 19:58 ` [PATCH 0/5] net/rds: move sysctl-only code under CONFIG_SYSCTL Allison Henderson
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=atzRiBWrLVTMSrpn@redhat.com \
--to=oleg@redhat.com \
--cc=achender@kernel.org \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=joel.granados@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/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