From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 920E8C3F68F for ; Wed, 4 Dec 2019 16:53:49 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 5E40E20862 for ; Wed, 4 Dec 2019 16:53:49 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5E40E20862 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id EC7F46B0BA4; Wed, 4 Dec 2019 11:53:48 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id E50BD6B0BA5; Wed, 4 Dec 2019 11:53:48 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D3F686B0BA6; Wed, 4 Dec 2019 11:53:48 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0126.hostedemail.com [216.40.44.126]) by kanga.kvack.org (Postfix) with ESMTP id BA2B16B0BA4 for ; Wed, 4 Dec 2019 11:53:48 -0500 (EST) Received: from smtpin25.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with SMTP id 7EBBA180AD806 for ; Wed, 4 Dec 2019 16:53:48 +0000 (UTC) X-FDA: 76228055736.25.nail46_3e4e0b4c1901c X-HE-Tag: nail46_3e4e0b4c1901c X-Filterd-Recvd-Size: 3480 Received: from gentwo.org (gentwo.org [3.19.106.255]) by imf38.hostedemail.com (Postfix) with ESMTP for ; Wed, 4 Dec 2019 16:53:48 +0000 (UTC) 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 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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");