linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Christopher Lameter <cl@linux.com>
To: Michal Hocko <mhocko@kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>, linux-mm@kvack.org
Subject: Re: SLUB: purpose of sysfs events on cache creation/removal
Date: Wed, 4 Dec 2019 16:53:47 +0000 (UTC)	[thread overview]
Message-ID: <alpine.DEB.2.21.1912041652410.29709@www.lameter.com> (raw)
In-Reply-To: <20191204153225.GM25242@dhcp22.suse.cz>

On Wed, 4 Dec 2019, Michal Hocko wrote:

> As I've said I believe it is quite risky. But if you as a maintainer
> believe this is the right thing to do I will not object. Care to send a
> patch?

From: Christoph Lameter <cl@linux.com>
Subject: slub: Remove userspace notifier for cache add/remove

Kmem caches are internal kernel structures so it is strange that
userspace notifiers would be needed. And I am not aware of any use
of these notifiers. These notifiers may just exist because in the
initial slub release the sysfs code was copied from another
subsystem.

Signed-off-by: Christoph Lameter <cl@linux.com>

Index: linux/mm/slub.c
===================================================================
--- linux.orig/mm/slub.c	2019-12-02 15:13:23.948312925 +0000
+++ linux/mm/slub.c	2019-12-04 16:32:34.648550310 +0000
@@ -5632,19 +5632,6 @@ static struct kobj_type slab_ktype = {
 	.release = kmem_cache_release,
 };

-static int uevent_filter(struct kset *kset, struct kobject *kobj)
-{
-	struct kobj_type *ktype = get_ktype(kobj);
-
-	if (ktype == &slab_ktype)
-		return 1;
-	return 0;
-}
-
-static const struct kset_uevent_ops slab_uevent_ops = {
-	.filter = uevent_filter,
-};
-
 static struct kset *slab_kset;

 static inline struct kset *cache_kset(struct kmem_cache *s)
@@ -5712,7 +5699,6 @@ static void sysfs_slab_remove_workfn(str
 #ifdef CONFIG_MEMCG
 	kset_unregister(s->memcg_kset);
 #endif
-	kobject_uevent(&s->kobj, KOBJ_REMOVE);
 out:
 	kobject_put(&s->kobj);
 }
@@ -5770,7 +5756,6 @@ static int sysfs_slab_add(struct kmem_ca
 	}
 #endif

-	kobject_uevent(&s->kobj, KOBJ_ADD);
 	if (!unmergeable) {
 		/* Setup first alias */
 		sysfs_slab_alias(s, s->name);
@@ -5851,7 +5836,7 @@ static int __init slab_sysfs_init(void)

 	mutex_lock(&slab_mutex);

-	slab_kset = kset_create_and_add("slab", &slab_uevent_ops, kernel_kobj);
+	slab_kset = kset_create_and_add("slab", NULL, kernel_kobj);
 	if (!slab_kset) {
 		mutex_unlock(&slab_mutex);
 		pr_err("Cannot register slab subsystem.\n");


  reply	other threads:[~2019-12-04 16:53 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-26 12:19 Michal Hocko
2019-11-26 16:32 ` Christopher Lameter
2019-11-26 16:54   ` Michal Hocko
2019-11-27 15:40     ` Christopher Lameter
2019-11-27 16:24       ` Michal Hocko
2019-11-27 16:26         ` Christopher Lameter
2019-11-27 17:43           ` Michal Hocko
2019-12-04 13:28             ` Michal Hocko
2019-12-04 15:25               ` Christopher Lameter
2019-12-04 15:32                 ` Michal Hocko
2019-12-04 16:53                   ` Christopher Lameter [this message]
2019-12-04 17:32                     ` Michal Hocko
2020-01-06 11:57                       ` Michal Hocko
2020-01-06 15:51                         ` Christopher Lameter
2020-01-09 14:52                           ` Michal Hocko
2020-01-09 19:44                             ` Andrew Morton
2020-01-09 20:13                               ` Michal Hocko
2020-01-09 20:15                               ` Michal Hocko
2020-01-17 17:13                               ` Michal Koutný
2020-01-19  0:15                                 ` Andrew Morton
2020-01-27 17:33                                   ` Michal Koutný
2020-01-27 23:04                                     ` Christopher Lameter
2020-01-28  8:51                                       ` Michal Koutný
2020-01-28 18:13                                         ` Christopher Lameter
2020-01-30 13:16                                           ` Vlastimil Babka
2020-01-09 14:07                     ` Vlastimil Babka

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=alpine.DEB.2.21.1912041652410.29709@www.lameter.com \
    --to=cl@linux.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@kernel.org \
    /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