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.1 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,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 33990C433E0 for ; Fri, 19 Mar 2021 05:29:11 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 9000664F59 for ; Fri, 19 Mar 2021 05:29:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9000664F59 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 D3FA56B006E; Fri, 19 Mar 2021 01:29:09 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id CEF5A6B0071; Fri, 19 Mar 2021 01:29:09 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B69E06B0072; Fri, 19 Mar 2021 01:29:09 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0210.hostedemail.com [216.40.44.210]) by kanga.kvack.org (Postfix) with ESMTP id 981CD6B006E for ; Fri, 19 Mar 2021 01:29:09 -0400 (EDT) Received: from smtpin02.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 4C0661802746D for ; Fri, 19 Mar 2021 05:29:09 +0000 (UTC) X-FDA: 77935495218.02.9FD02A4 Received: from m43-7.mailgun.net (m43-7.mailgun.net [69.72.43.7]) by imf05.hostedemail.com (Postfix) with ESMTP id DDB7EE0011CE for ; Fri, 19 Mar 2021 05:29:06 +0000 (UTC) DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1616131748; h=Content-Transfer-Encoding: Content-Type: In-Reply-To: MIME-Version: Date: Message-ID: References: Cc: To: Subject: From: Sender; bh=VTAKXw7WlZVhBAejybzu0WxOXgO+LUFwedSeWJKzMzM=; b=v92lv9T2VDnYM+rnLOrrzf0lM9xOdrJLpYb3Jpq++sjXbZ2Yrc+PWP8TMaAAwcWUAvPN3L7c 05EoPHePW1CiYGoc82yLGU7qx4RsEowIQpd7FJg1cFNfpOoWQ2mKAEamjLmUHDtu2owBuBuB EjCQAXVAL4IKsk45ikCuww9MVRU= X-Mailgun-Sending-Ip: 69.72.43.7 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-n04.prod.us-west-2.postgun.com with SMTP id 6054369e2b0e10a0ba44e834 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Fri, 19 Mar 2021 05:29:02 GMT Received: by smtp.codeaurora.org (Postfix, from userid 1001) id D623EC43462; Fri, 19 Mar 2021 05:29:01 +0000 (UTC) Received: from [192.168.100.4] (unknown [27.116.18.21]) (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 95900C43463; Fri, 19 Mar 2021 05:28:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 95900C43463 Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=fail smtp.mailfrom=faiyazm@codeaurora.org From: Faiyaz Mohammed Subject: Re: [PATCH v2] mm: slub: Convert sys slab alloc_calls, free_calls to bin attribute To: Greg Kroah-Hartman , Vlastimil Babka 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> Message-ID: <3ac1d3e6-6207-96ad-16a1-0f5139d8b2b5@codeaurora.org> Date: Fri, 19 Mar 2021 10:58:55 +0530 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: DDB7EE0011CE X-Stat-Signature: f8b7mj8kn7tzmuzxbhbo65pnmo1ezf9q Received-SPF: none (mg.codeaurora.org>: No applicable sender policy available) receiver=imf05; identity=mailfrom; envelope-from=""; helo=m43-7.mailgun.net; client-ip=69.72.43.7 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1616131746-549271 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: 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?. 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 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