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=-10.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,MAILING_LIST_MULTI, NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham 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 BB9B3C433E0 for ; Fri, 19 Mar 2021 09:40:53 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 5AF4464F68 for ; Fri, 19 Mar 2021 09:40:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5AF4464F68 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 DF7526B0073; Fri, 19 Mar 2021 05:40:52 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DCED76B0074; Fri, 19 Mar 2021 05:40:52 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C97C96B0075; Fri, 19 Mar 2021 05:40:52 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0192.hostedemail.com [216.40.44.192]) by kanga.kvack.org (Postfix) with ESMTP id AECA96B0073 for ; Fri, 19 Mar 2021 05:40:52 -0400 (EDT) Received: from smtpin21.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 737AF6C2D for ; Fri, 19 Mar 2021 09:40:52 +0000 (UTC) X-FDA: 77936129544.21.E7E073F Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf08.hostedemail.com (Postfix) with ESMTP id B1E3080192C0 for ; Fri, 19 Mar 2021 09:40:48 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id C81CDAE05; Fri, 19 Mar 2021 09:40:50 +0000 (UTC) Subject: Re: [PATCH v2] mm: slub: Convert sys slab alloc_calls, free_calls to bin attribute To: Faiyaz Mohammed , Greg Kroah-Hartman Cc: cl@linux.com, penberg@kernel.org, rientjes@google.com, iamjoonsoo.kim@lge.com, akpm@linux-foundation.org, willy@infradead.org, vinmenon@codeaurora.org, Peter Zijlstra , linux-mm@kvack.org References: <1613543513-11965-1-git-send-email-faiyazm@codeaurora.org> <13df1c88-3848-1969-5424-33a927ec033e@suse.cz> <3ac1d3e6-6207-96ad-16a1-0f5139d8b2b5@codeaurora.org> From: Vlastimil Babka Message-ID: <54b85eda-cfe5-a6f0-528b-0963ff7e5ef1@suse.cz> Date: Fri, 19 Mar 2021 10:40:49 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.0 MIME-Version: 1.0 In-Reply-To: <3ac1d3e6-6207-96ad-16a1-0f5139d8b2b5@codeaurora.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Stat-Signature: yzuobnx8a959wss61ieeu7k5bhredfxq X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: B1E3080192C0 Received-SPF: none (suse.cz>: No applicable sender policy available) receiver=imf08; identity=mailfrom; envelope-from=""; helo=mx2.suse.de; client-ip=195.135.220.15 X-HE-DKIM-Result: none/none X-HE-Tag: 1616146848-794250 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 3/19/21 6:28 AM, Faiyaz Mohammed wrote: > Hi, > > Sorry for late response! > > On 3/2/2021 6:41 PM, Greg Kroah-Hartman wrote: >> On Tue, Mar 02, 2021 at 01:59:46PM +0100, Vlastimil Babka wrote: >>> On 2/17/21 7:31 AM, Faiyaz Mohammed wrote: >>>> Reading the sys slab alloc_calls, free_calls returns the available object >>>> owners, but the size of this file is limited to PAGE_SIZE >>>> because of the limitation of sysfs attributes, it is returning the >>>> partial owner info, which is not sufficient to debug/account the slab >>>> memory and alloc_calls output is not matching with /proc/slabinfo. >>>> >>>> To remove the PAGE_SIZE limitation converted the sys slab >>>> alloc_calls, free_calls to bin attribut >>>> >>>> Signed-off-by: Faiyaz Mohammed >>> >>> After discussing this with Greg and PeterZ, sysfs should be one value per file, >>> and is just not proper API for this kind of info. We should reimplement at least >>> these clearly debugging "attributes" in debugfs, where they belong, instead of >>> trying to hack around the limitation in sysfs. >> >> sysfs is _REQUIRED_ to be "one value per file", any kernel code that >> abuses this needs to be fixed up. >> >> Why are these slab files in sysfs at all anyway? They all feel like >> debugging stuff to me, why not move everything to debugfs? Would make >> for a lot less code overall. >> > Yes, we can move the /sys/kernel/slab/kmemcache/alloc_calls and > /sys/kernel/slab/kmemcache/free_calls implementation to debugfs but is > it okay to move only alloc_calls and free_calls? or we have to move > whole sysfs interface to debugfs?. I don't think we need to move everything, just files where it makes sense. > If we are moving only alloc_calls/free_calls interface to debugfs then I > think we can add all slab objects data into single file. > > For example: /sys/kernel/debugfs/slab/alloc_calls, which will print all > slab objects data. > > Example Output: alloc_list: call_site=__request_region+0xb4/0x2f0 > count=228 object_size=128 slab_size=640 slab_name=kmalloc-128 I wouldn't do this, as processing all caches will have a large overhead and then somebody interested in single cache would throw most of the info away. > or > > We can have just like current sysfs interface, have separate > alloc_calls/free_calls traces per kmem cache. > > Which one would be better?. > >> > > Thanks and regards, > Mohammed Faiyaz >