mbox series

[V2,0/2] Introduce slabinfo version 2.2

Message ID 20240219031911.10372-1-fangzheng.zhang@unisoc.com (mailing list archive)
Headers show
Series Introduce slabinfo version 2.2 | expand

Message

Fangzheng Zhang Feb. 19, 2024, 3:19 a.m. UTC
Hi all,

This series introduces slabinfo version 2.2 to users.
In slabinfo V2.2, we added a slabreclaim column to
record whether each slab pool is of reclaim type.
This will be more conducive for users to obtain
the type of each slabdata more intuitively than through
the interface /sys/kernel/slab/$cache/reclaim_account.
And we have added an example of the output result
executing '> cat proc/slabinfo' in the file
Documentation/filesystems/proc.rst.

Changes in v2:
- Modify the slabinfo version number to 2.2.
- Add an example of slabinfo output and future works.

Changes in v1:
- Add a slabreclaim column to record type of each slab
  in file proc/slabinfo.

[1] https://lore.kernel.org/linux-mm/20240131094442.28834-1-fangzheng.zhang@unisoc.com/

Fangzheng Zhang (2):
  mm/slab: Add slabreclaim flag to slabinfo
  Documentation: filesystems: introduce proc/slabinfo to users

 Documentation/filesystems/proc.rst | 33 ++++++++++++++++++++++++++++++
 mm/slab_common.c                   |  9 ++++----
 2 files changed, 38 insertions(+), 4 deletions(-)

Comments

Chengming Zhou Feb. 19, 2024, 11:29 a.m. UTC | #1
On 2024/2/19 11:19, Fangzheng Zhang wrote:
> Hi all,
> 
> This series introduces slabinfo version 2.2 to users.
> In slabinfo V2.2, we added a slabreclaim column to
> record whether each slab pool is of reclaim type.
> This will be more conducive for users to obtain
> the type of each slabdata more intuitively than through
> the interface /sys/kernel/slab/$cache/reclaim_account.

I want to recommend a better tool: drgn[1] for these tasks, instead of changing
the output format of /proc/slabinfo, which may break existing userspace tools.

[1] https://drgn.readthedocs.io/en/latest/index.html#

> And we have added an example of the output result
> executing '> cat proc/slabinfo' in the file
> Documentation/filesystems/proc.rst.
> 
> Changes in v2:
> - Modify the slabinfo version number to 2.2.
> - Add an example of slabinfo output and future works.
> 
> Changes in v1:
> - Add a slabreclaim column to record type of each slab
>   in file proc/slabinfo.
> 
> [1] https://lore.kernel.org/linux-mm/20240131094442.28834-1-fangzheng.zhang@unisoc.com/
> 
> Fangzheng Zhang (2):
>   mm/slab: Add slabreclaim flag to slabinfo
>   Documentation: filesystems: introduce proc/slabinfo to users
> 
>  Documentation/filesystems/proc.rst | 33 ++++++++++++++++++++++++++++++
>  mm/slab_common.c                   |  9 ++++----
>  2 files changed, 38 insertions(+), 4 deletions(-)
>
zhang fangzheng Feb. 20, 2024, 6:25 a.m. UTC | #2
On Mon, Feb 19, 2024 at 7:29 PM Chengming Zhou
<zhouchengming@bytedance.com> wrote:
>
> On 2024/2/19 11:19, Fangzheng Zhang wrote:
> > Hi all,
> >
> > This series introduces slabinfo version 2.2 to users.
> > In slabinfo V2.2, we added a slabreclaim column to
> > record whether each slab pool is of reclaim type.
> > This will be more conducive for users to obtain
> > the type of each slabdata more intuitively than through
> > the interface /sys/kernel/slab/$cache/reclaim_account.
>
> I want to recommend a better tool: drgn[1] for these tasks, instead of changing
> the output format of /proc/slabinfo, which may break existing userspace tools.
>
> [1] https://drgn.readthedocs.io/en/latest/index.html#
>

Thank you very much for providing a new way.
I have the following three questions about the new tool you provided:
---- 1. From the introduction, the tool is described as an alternative
to the crash utility.
          Will the permission requirements have different effects when
used, user or userdebug?
----  2. The 'Helpers' chapter introduces the simple use of
common.memory, but there is no output example.
           It involves the use of slab objects, but it also needs to
provide a specific slab_cache_name,
           which cannot give an intuitive overall information like
proc/slabinfo.
           I guess it is difficult to achieve direct output of slab
type (reclaim or unreclaim). I don’t know, right?
---- 3. Regarding the supported versions, is it supported for both
arm/arm64? I don't seem to have seen any similar instructions.
Finally, I would like to express my gratitude again. This tool will be
very helpful for me in other future work.

> > And we have added an example of the output result
> > executing '> cat proc/slabinfo' in the file
> > Documentation/filesystems/proc.rst.
> >
> > Changes in v2:
> > - Modify the slabinfo version number to 2.2.
> > - Add an example of slabinfo output and future works.
> >
> > Changes in v1:
> > - Add a slabreclaim column to record type of each slab
> >   in file proc/slabinfo.
> >
> > [1] https://lore.kernel.org/linux-mm/20240131094442.28834-1-fangzheng.zhang@unisoc.com/
> >
> > Fangzheng Zhang (2):
> >   mm/slab: Add slabreclaim flag to slabinfo
> >   Documentation: filesystems: introduce proc/slabinfo to users
> >
> >  Documentation/filesystems/proc.rst | 33 ++++++++++++++++++++++++++++++
> >  mm/slab_common.c                   |  9 ++++----
> >  2 files changed, 38 insertions(+), 4 deletions(-)
> >
Chengming Zhou Feb. 20, 2024, 7:09 a.m. UTC | #3
On 2024/2/20 14:25, zhang fangzheng wrote:
> On Mon, Feb 19, 2024 at 7:29 PM Chengming Zhou
> <zhouchengming@bytedance.com> wrote:
>>
>> On 2024/2/19 11:19, Fangzheng Zhang wrote:
>>> Hi all,
>>>
>>> This series introduces slabinfo version 2.2 to users.
>>> In slabinfo V2.2, we added a slabreclaim column to
>>> record whether each slab pool is of reclaim type.
>>> This will be more conducive for users to obtain
>>> the type of each slabdata more intuitively than through
>>> the interface /sys/kernel/slab/$cache/reclaim_account.
>>
>> I want to recommend a better tool: drgn[1] for these tasks, instead of changing
>> the output format of /proc/slabinfo, which may break existing userspace tools.
>>
>> [1] https://drgn.readthedocs.io/en/latest/index.html#
>>
> 
> Thank you very much for providing a new way.
> I have the following three questions about the new tool you provided:
> ---- 1. From the introduction, the tool is described as an alternative
> to the crash utility.
>           Will the permission requirements have different effects when
> used, user or userdebug?
> ----  2. The 'Helpers' chapter introduces the simple use of
> common.memory, but there is no output example.
>            It involves the use of slab objects, but it also needs to
> provide a specific slab_cache_name,
>            which cannot give an intuitive overall information like
> proc/slabinfo.

You can of course use drgn to iterate over all slabs by using the global
"slab_caches" list. (All kernel space is at your hand.)

>            I guess it is difficult to achieve direct output of slab
> type (reclaim or unreclaim). I don’t know, right?

It's easy for drgn to inspect each slab's information.

> ---- 3. Regarding the supported versions, is it supported for both
> arm/arm64? I don't seem to have seen any similar instructions.
> Finally, I would like to express my gratitude again. This tool will be
> very helpful for me in other future work.

Please check https://github.com/osandov/drgn for details.

Thanks.