From: Luis Chamberlain <mcgrof@kernel.org>
To: akpm@linux-foundation.org, keescook@chromium.org,
yzaikin@google.com, nixiaoming@huawei.com, ebiederm@xmission.com,
clemens@ladisch.de, arnd@arndb.de, gregkh@linuxfoundation.org,
jani.nikula@linux.intel.com, joonas.lahtinen@linux.intel.com,
rodrigo.vivi@intel.com, tvrtko.ursulin@linux.intel.com,
airlied@linux.ie, "daniel@ffwll.chairlied"@linux.ie,
benh@kernel.crashing.org, mark@fasheh.com, jlbec@evilplan.org,
joseph.qi@linux.alibaba.com, jack@suse.cz, amir73il@gmail.com,
phil@philpotter.co.uk, viro@zeniv.linux.org.uk,
julia.lawall@inria.fr
Cc: intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org,
dri-devel@lists.freedesktop.org,
Luis Chamberlain <mcgrof@kernel.org>,
linux-fsdevel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
ocfs2-devel@oss.oracle.com
Subject: [Intel-gfx] [PATCH v2 8/8] eventpoll: simplify sysctl declaration with register_sysctl()
Date: Tue, 23 Nov 2021 12:24:22 -0800 [thread overview]
Message-ID: <20211123202422.819032-9-mcgrof@kernel.org> (raw)
In-Reply-To: <20211123202422.819032-1-mcgrof@kernel.org>
From: Xiaoming Ni <nixiaoming@huawei.com>
The kernel/sysctl.c is a kitchen sink where everyone leaves
their dirty dishes, this makes it very difficult to maintain.
To help with this maintenance let's start by moving sysctls to
places where they actually belong. The proc sysctl maintainers
do not want to know what sysctl knobs you wish to add for your own
piece of code, we just care about the core logic.
So move the epoll_table sysctl to fs/eventpoll.c and use
use register_sysctl().
Signed-off-by: Xiaoming Ni <nixiaoming@huawei.com>
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
---
fs/eventpoll.c | 10 +++++++++-
include/linux/poll.h | 2 --
include/linux/sysctl.h | 1 -
kernel/sysctl.c | 7 -------
4 files changed, 9 insertions(+), 11 deletions(-)
diff --git a/fs/eventpoll.c b/fs/eventpoll.c
index 06f4c5ae1451..e2daa940ebce 100644
--- a/fs/eventpoll.c
+++ b/fs/eventpoll.c
@@ -307,7 +307,7 @@ static void unlist_file(struct epitems_head *head)
static long long_zero;
static long long_max = LONG_MAX;
-struct ctl_table epoll_table[] = {
+static struct ctl_table epoll_table[] = {
{
.procname = "max_user_watches",
.data = &max_user_watches,
@@ -319,6 +319,13 @@ struct ctl_table epoll_table[] = {
},
{ }
};
+
+static void __init epoll_sysctls_init(void)
+{
+ register_sysctl("fs/epoll", epoll_table);
+}
+#else
+#define epoll_sysctls_init() do { } while (0)
#endif /* CONFIG_SYSCTL */
static const struct file_operations eventpoll_fops;
@@ -2378,6 +2385,7 @@ static int __init eventpoll_init(void)
/* Allocates slab cache used to allocate "struct eppoll_entry" */
pwq_cache = kmem_cache_create("eventpoll_pwq",
sizeof(struct eppoll_entry), 0, SLAB_PANIC|SLAB_ACCOUNT, NULL);
+ epoll_sysctls_init();
ephead_cache = kmem_cache_create("ep_head",
sizeof(struct epitems_head), 0, SLAB_PANIC|SLAB_ACCOUNT, NULL);
diff --git a/include/linux/poll.h b/include/linux/poll.h
index 1cdc32b1f1b0..a9e0e1c2d1f2 100644
--- a/include/linux/poll.h
+++ b/include/linux/poll.h
@@ -8,12 +8,10 @@
#include <linux/wait.h>
#include <linux/string.h>
#include <linux/fs.h>
-#include <linux/sysctl.h>
#include <linux/uaccess.h>
#include <uapi/linux/poll.h>
#include <uapi/linux/eventpoll.h>
-extern struct ctl_table epoll_table[]; /* for sysctl */
/* ~832 bytes of stack space used max in sys_select/sys_poll before allocating
additional memory. */
#ifdef __clang__
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index 718492057c70..5e0428a71899 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -218,7 +218,6 @@ extern int no_unaligned_warning;
extern struct ctl_table sysctl_mount_point[];
extern struct ctl_table random_table[];
extern struct ctl_table firmware_config_table[];
-extern struct ctl_table epoll_table[];
#else /* CONFIG_SYSCTL */
static inline struct ctl_table_header *register_sysctl_table(struct ctl_table * table)
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 6aa67c737e4e..b09ff41720e3 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -3092,13 +3092,6 @@ static struct ctl_table fs_table[] = {
.proc_handler = proc_dointvec,
},
#endif
-#ifdef CONFIG_EPOLL
- {
- .procname = "epoll",
- .mode = 0555,
- .child = epoll_table,
- },
-#endif
#endif
{
.procname = "protected_symlinks",
--
2.33.0
next prev parent reply other threads:[~2021-11-23 20:25 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-23 20:24 [Intel-gfx] [PATCH v2 0/8] sysctl: second set of kernel/sysctl cleanups Luis Chamberlain
2021-11-23 20:24 ` [Intel-gfx] [PATCH v2 1/8] hpet: simplify subdirectory registration with register_sysctl() Luis Chamberlain
2021-11-23 20:24 ` [Intel-gfx] [PATCH v2 2/8] i915: " Luis Chamberlain
2021-11-25 9:41 ` Jani Nikula
2021-11-23 20:24 ` [Intel-gfx] [PATCH v2 3/8] macintosh/mac_hid.c: " Luis Chamberlain
2021-11-23 20:24 ` [Intel-gfx] [PATCH v2 4/8] ocfs2: " Luis Chamberlain
2021-11-24 9:49 ` Jan Kara
2021-11-23 20:24 ` [Intel-gfx] [PATCH v2 5/8] test_sysctl: " Luis Chamberlain
2021-11-23 20:24 ` [Intel-gfx] [PATCH v2 6/8] inotify: " Luis Chamberlain
2021-11-24 9:44 ` Jan Kara
2021-11-24 13:40 ` Luis Chamberlain
2021-11-23 20:24 ` [Intel-gfx] [PATCH v2 7/8] cdrom: " Luis Chamberlain
2021-11-25 9:23 ` Phillip Potter
2021-11-23 20:24 ` Luis Chamberlain [this message]
2021-11-23 22:56 ` [Intel-gfx] ✗ Fi.CI.BUILD: failure for sysctl: second set of kernel/sysctl cleanups Patchwork
2021-11-24 13:59 ` [Intel-gfx] ✗ Fi.CI.BUILD: failure for sysctl: second set of kernel/sysctl cleanups (rev2) Patchwork
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=20211123202422.819032-9-mcgrof@kernel.org \
--to=mcgrof@kernel.org \
--cc="daniel@ffwll.chairlied"@linux.ie \
--cc=airlied@linux.ie \
--cc=akpm@linux-foundation.org \
--cc=amir73il@gmail.com \
--cc=arnd@arndb.de \
--cc=benh@kernel.crashing.org \
--cc=clemens@ladisch.de \
--cc=dri-devel@lists.freedesktop.org \
--cc=ebiederm@xmission.com \
--cc=gregkh@linuxfoundation.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=jack@suse.cz \
--cc=jani.nikula@linux.intel.com \
--cc=jlbec@evilplan.org \
--cc=joonas.lahtinen@linux.intel.com \
--cc=joseph.qi@linux.alibaba.com \
--cc=julia.lawall@inria.fr \
--cc=keescook@chromium.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mark@fasheh.com \
--cc=nixiaoming@huawei.com \
--cc=ocfs2-devel@oss.oracle.com \
--cc=phil@philpotter.co.uk \
--cc=rodrigo.vivi@intel.com \
--cc=tvrtko.ursulin@linux.intel.com \
--cc=viro@zeniv.linux.org.uk \
--cc=yzaikin@google.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