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.6 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 06408C47082 for ; Mon, 31 May 2021 07:12:05 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 86D7E6100A for ; Mon, 31 May 2021 07:12:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 86D7E6100A Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 1A82B6B0036; Mon, 31 May 2021 03:12:04 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 17F108D0001; Mon, 31 May 2021 03:12:04 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 046966B0070; Mon, 31 May 2021 03:12:03 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0149.hostedemail.com [216.40.44.149]) by kanga.kvack.org (Postfix) with ESMTP id C43B06B0036 for ; Mon, 31 May 2021 03:12:03 -0400 (EDT) Received: from smtpin20.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 681658E58 for ; Mon, 31 May 2021 07:12:03 +0000 (UTC) X-FDA: 78200656926.20.365A059 Received: from so254-9.mailgun.net (so254-9.mailgun.net [198.61.254.9]) by imf08.hostedemail.com (Postfix) with ESMTP id 8994B801935B for ; Mon, 31 May 2021 07:11:49 +0000 (UTC) DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1622445123; h=Content-Transfer-Encoding: Content-Type: In-Reply-To: MIME-Version: Date: Message-ID: From: References: Cc: To: Subject: Sender; bh=er6iWpFOnYRYhyjNz1Ul7BlyTO2daX+WJ02mH9iGGYg=; b=a9B7NK+SJJBiQYWfbSSk3/Sd9hs3Ub0H6CRYBoILdsaY33ALNcTH3jKSzco4CVaxoDCmBU0L yrv+mvHhDeXacRrF/30hml8Tcl9j3QyeO9Y93jghpjHuuG9ZB0LT7s4ncS7IMYwEkGww3gp/ BfcPrHBt/MmBOgznmef+U1KWh5o= X-Mailgun-Sending-Ip: 198.61.254.9 X-Mailgun-Sid: WyIwY2Q3OCIsICJsaW51eC1tbUBrdmFjay5vcmciLCAiYmU5ZTRhIl0= Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n01.prod.us-west-2.postgun.com with SMTP id 60b48c2e8491191eb32bbaec (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Mon, 31 May 2021 07:11:42 GMT Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 913C1C43460; Mon, 31 May 2021 07:11:42 +0000 (UTC) Received: from [192.168.0.105] (unknown [49.204.182.232]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: faiyazm) by smtp.codeaurora.org (Postfix) with ESMTPSA id C81DAC433D3; Mon, 31 May 2021 07:11:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org C81DAC433D3 Subject: Re: [PATCH v7] mm: slub: move sysfs slab alloc/free interfaces to debugfs To: Vlastimil Babka , Greg KH Cc: 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> <0b0e5e43-2ccf-a8a4-1e3b-ab2326c55321@suse.cz> From: Faiyaz Mohammed Message-ID: Date: Mon, 31 May 2021 12:41:36 +0530 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.10.2 MIME-Version: 1.0 In-Reply-To: <0b0e5e43-2ccf-a8a4-1e3b-ab2326c55321@suse.cz> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=mg.codeaurora.org header.s=smtp header.b=a9B7NK+S; spf=pass (imf08.hostedemail.com: domain of bounce@mg.codeaurora.org designates 198.61.254.9 as permitted sender) smtp.mailfrom=bounce@mg.codeaurora.org; dmarc=none X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 8994B801935B X-Stat-Signature: hfz1fbctc1f1bo7anxpeiesywgitgu9o X-HE-Tag: 1622445109-309092 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/2021 5:43 PM, Vlastimil Babka wrote: > On 5/26/21 1:48 PM, Greg KH wrote: >> On Wed, May 26, 2021 at 01:38:55PM +0200, Vlastimil Babka wrote: >>> >>> alias_list a single list and both slab_sysfs_init() and slab_debugfs_init() >>> 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 with both >>> sysfs and debugfs processing (probably more complicated). >>> >>> 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. >>> >>> But with debugfs, what are the guarantees that things won't blow up when a >>> debugfs file is being read while somebody calls kmem_cache_destroy() on the cache? >> >> 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 block) and > only then proceed with slab_kmem_cache_release() which destroys the fundamental > structures such as kmem_cache_node, which are also accessed by the debugfs file > handlers. > If user is trying to read the data during shutdown_cache(), then I think it's possible user will get empty data, to avoid that we can call debugfs_slab_release() first and then do other stuff in shutdown_cache(). >> 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, >> >> greg k-h >> >