linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Vlastimil Babka <vbabka@suse.cz>
To: Faiyaz Mohammed <faiyazm@codeaurora.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
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 <peterz@infradead.org>,
	linux-mm@kvack.org
Subject: Re: [PATCH v2] mm: slub: Convert sys slab alloc_calls, free_calls to bin attribute
Date: Fri, 19 Mar 2021 10:40:49 +0100	[thread overview]
Message-ID: <54b85eda-cfe5-a6f0-528b-0963ff7e5ef1@suse.cz> (raw)
In-Reply-To: <3ac1d3e6-6207-96ad-16a1-0f5139d8b2b5@codeaurora.org>

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 <faiyazm@codeaurora.org>
>>>
>>> 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
> 



      parent reply	other threads:[~2021-03-19  9:40 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1613543513-11965-1-git-send-email-faiyazm@codeaurora.org>
2021-02-17 11:38 ` Faiyaz Mohammed
     [not found] ` <13df1c88-3848-1969-5424-33a927ec033e@suse.cz>
     [not found]   ` <YD45e70b48gyXkIg@kroah.com>
2021-03-19  5:28     ` Faiyaz Mohammed
2021-03-19  6:54       ` Greg Kroah-Hartman
2021-03-19  9:40       ` Vlastimil Babka [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=54b85eda-cfe5-a6f0-528b-0963ff7e5ef1@suse.cz \
    --to=vbabka@suse.cz \
    --cc=akpm@linux-foundation.org \
    --cc=cl@linux.com \
    --cc=faiyazm@codeaurora.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=iamjoonsoo.kim@lge.com \
    --cc=linux-mm@kvack.org \
    --cc=penberg@kernel.org \
    --cc=peterz@infradead.org \
    --cc=rientjes@google.com \
    --cc=vinmenon@codeaurora.org \
    --cc=willy@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox