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.1 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no 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 86C78C2B9F7 for ; Wed, 26 May 2021 12:13:29 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id DBC17613DC for ; Wed, 26 May 2021 12:13:28 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DBC17613DC Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 784236B0036; Wed, 26 May 2021 08:13:28 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 73E886B006E; Wed, 26 May 2021 08:13:28 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 586486B0070; Wed, 26 May 2021 08:13:28 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0197.hostedemail.com [216.40.44.197]) by kanga.kvack.org (Postfix) with ESMTP id 229BE6B0036 for ; Wed, 26 May 2021 08:13:28 -0400 (EDT) Received: from smtpin06.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id BAD9B181AEF23 for ; Wed, 26 May 2021 12:13:27 +0000 (UTC) X-FDA: 78183272454.06.0A07C20 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by imf18.hostedemail.com (Postfix) with ESMTP id CDE392000986 for ; Wed, 26 May 2021 12:13:20 +0000 (UTC) Received: from imap.suse.de (imap-alt.suse-dmz.suse.de [192.168.254.47]) by smtp-out1.suse.de (Postfix) with ESMTP id D94A3218C8; Wed, 26 May 2021 12:13:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1622031205; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OWYxOJflFG1uSB7U04nw20Q2EPzaSUW/18EMjnBHn1A=; b=gOaVL66Aq3P2aUlbEeQW+wEVlUc1BXanRMehHFdMLOK39J4N5WAqkeSIvg0u7E8P/ppNNQ /zN68cmoBtkQq3Xj/GoTnCMAQfwJqC1VEGES5gHYUx3C5405GHCav/iUgqL0kpdnodqdJf sY86/wDEnMzDE8OSrf7ytnPWhEktZyE= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1622031205; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OWYxOJflFG1uSB7U04nw20Q2EPzaSUW/18EMjnBHn1A=; b=Ne14iacTkhEN/Pil8RGLPNGrqj+yL9Q9xZ2Zov5LtLIds+pF0g3EkGLAAxXnE5ectxb+sN iM75pznJLEf5P2Ag== Received: from director2.suse.de (director2.suse-dmz.suse.de [192.168.254.72]) by imap.suse.de (Postfix) with ESMTPSA id BD35711A98; Wed, 26 May 2021 12:13:25 +0000 (UTC) To: Greg KH Cc: Faiyaz Mohammed , cl@linux.com, penberg@kernel.org, rientjes@google.com, iamjoonsoo.kim@lge.com, akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, glittao@gmail.com, vinmenon@codeaurora.org References: <1621928285-751-1-git-send-email-faiyazm@codeaurora.org> <86d843f0-bbef-7c3b-6b6a-5d6b32434bee@suse.cz> From: Vlastimil Babka Subject: Re: [PATCH v7] mm: slub: move sysfs slab alloc/free interfaces to debugfs Message-ID: <0b0e5e43-2ccf-a8a4-1e3b-ab2326c55321@suse.cz> Date: Wed, 26 May 2021 14:13:25 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=gOaVL66A; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=Ne14iacT; dmarc=none; spf=pass (imf18.hostedemail.com: domain of vbabka@suse.cz designates 195.135.220.28 as permitted sender) smtp.mailfrom=vbabka@suse.cz X-Stat-Signature: aop73f3ibxt1zexzarkkbxa5awb8boxb X-Rspamd-Queue-Id: CDE392000986 X-Rspamd-Server: rspam02 X-HE-Tag: 1622031200-921540 Content-Transfer-Encoding: quoted-printable 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 5/26/21 1:48 PM, Greg KH wrote: > On Wed, May 26, 2021 at 01:38:55PM +0200, Vlastimil Babka wrote: >>=20 >> alias_list a single list and both slab_sysfs_init() and slab_debugfs_i= nit() >> flush it. So only the init call that happens to be called first, does = actually >> find an unflushed list. I think you >> need to use a separate list for debugfs (simpler) or a shared list wit= h both >> sysfs and debugfs processing (probably more complicated). >>=20 >> And finally a question, perhaps also for Greg. With sysfs, we hand out= the >> lifecycle of struct kmem_cache to sysfs, to ensure we are not reading = sysfs >> files of a cache that has been removed. >>=20 >> But with debugfs, what are the guarantees that things won't blow up wh= en a >> debugfs file is being read while somebody calls kmem_cache_destroy() o= n the cache? >=20 > It's much harder, but usually the default debugfs_file_create() will > handle this for you. See the debugfs_file_create_unsafe() for the > "other" variant where you know you can tear things down "safely". Right, so IIUC debugfs will guarantee that while somebody reads the files= , the debugfs cleanup will block, as debugfs_file_get() comment explains. In that case I think we have the cleanup order wrong in this patch: shutdown_cache() should first do debugfs_slab_release() (which would bloc= k) and only then proceed with slab_kmem_cache_release() which destroys the funda= mental structures such as kmem_cache_node, which are also accessed by the debugf= s file handlers. > That being said, yes there are still issues in this area, be careful > about what tools you expect to be constantly hitting debugfs files. FWIW, the files are accessible only to root. > thanks, >=20 > greg k-h >=20