Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp665245ybl; Wed, 4 Dec 2019 08:56:33 -0800 (PST) X-Google-Smtp-Source: APXvYqy6YDKoJx6KBGzWF7vBQnJc5rySLdXzSYOhw7Y/g3K8unBDn5YN8CTtXCgglY/PMILYzDfx X-Received: by 2002:a05:6830:1715:: with SMTP id 21mr3313804otk.67.1575478593430; Wed, 04 Dec 2019 08:56:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575478593; cv=none; d=google.com; s=arc-20160816; b=RF2X1eG63ze/cDlFxvzhBmavBIVuzDp40OQY15Zh4yxDFFSYKvF79fsgZHBy8pJpZz eNxsciBoawhTcLJP5o0n6ezdcsIumlLHTmjhHKgEqRrHZgUp7rBLpbcexvas3iJdjeDZ 4uho1EQjwR1I3oyhiFNVY6R5MWRSFawyYYDB3UfyNZEIVnJIyuoXVtcbLs2uqt3y0fWN GUIOc2vIZKMGwgKTCf2x6TXFuRNPHP+Bvrocoma5mVG/3onNVulPlgunbO0DmBj9PhiE q0Mq/WZSgauwIohkQpebsPxi9MgAFj5AiSVeXpTuXUwx11HVyd2lR3SCoQ/QsAJmsQis cAaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date; bh=CzOHkRBWv0SDchunYtrOcRU3HcAWpaYE2Op8MaMvoIc=; b=V9w508TBzDt1MZRp8SYwAC4pOXFW9iHyrCtHptTiFxM06sZNU9vU+VtGFgZ5e6Kwk2 1ApeRx/fhVtSTxfwyAlgQ1rfRoEtruOuAo62k3R6f0PfRFD8BnD8sc0oM4d8r1WnZyC5 l2UYpmuXtuWjtCcRfAW8l4HQonE8NHCSGV9UKUyjE4myT9yMa7QsIs4+N4ZZc4oI4k25 J8jaq8U5XkXw2126QsRVUaPzY54lN4mMYKr2HoIURx7Fq+6T2NmvbGadqFidZks+KKEt 8BmmUejDEWMjdjSnEfgDbi/Di7HboBfvVH8vRnnb4PBINydDRIKM3O9PD77Fh/+beW9a iAIQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x131si2329299oig.124.2019.12.04.08.56.20; Wed, 04 Dec 2019 08:56:33 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728952AbfLDQxs (ORCPT + 99 others); Wed, 4 Dec 2019 11:53:48 -0500 Received: from gentwo.org ([3.19.106.255]:46986 "EHLO gentwo.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728635AbfLDQxs (ORCPT ); Wed, 4 Dec 2019 11:53:48 -0500 Received: by gentwo.org (Postfix, from userid 1002) id 75E533EED9; Wed, 4 Dec 2019 16:53:47 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by gentwo.org (Postfix) with ESMTP id 736693E93B; Wed, 4 Dec 2019 16:53:47 +0000 (UTC) Date: Wed, 4 Dec 2019 16:53:47 +0000 (UTC) From: Christopher Lameter X-X-Sender: cl@www.lameter.com To: Michal Hocko cc: LKML , linux-mm@kvack.org Subject: Re: SLUB: purpose of sysfs events on cache creation/removal In-Reply-To: <20191204153225.GM25242@dhcp22.suse.cz> Message-ID: References: <20191126121901.GE20912@dhcp22.suse.cz> <20191126165420.GL20912@dhcp22.suse.cz> <20191127162400.GT20912@dhcp22.suse.cz> <20191127174317.GD26807@dhcp22.suse.cz> <20191204132812.GF25242@dhcp22.suse.cz> <20191204153225.GM25242@dhcp22.suse.cz> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 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 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");