public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
From: liubaolin <liubaolin12138@163.com>
To: "Ritesh Harjani (IBM)" <ritesh.list@gmail.com>,
	Andreas Dilger <adilger@dilger.ca>,
	Ojaswin Mujoo <ojaswin@linux.ibm.com>
Cc: tytso@mit.edu, wangguanyu@vivo.com, yi.zhang@huaweicloud.com,
	linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org,
	Baolin Liu <liubaolin@kylinos.cn>
Subject: Re: [PATCH v2 v2 2/2] ext4: allow clearing mballoc stats through mb_stats
Date: Tue, 21 Apr 2026 13:22:31 +0800	[thread overview]
Message-ID: <9a2d25d3-219f-481c-afb8-083c8b9417c1@163.com> (raw)
In-Reply-To: <7bq1t1zg.ritesh.list@gmail.com>

Dear all,
    I noticed the discussion about where to document the ext4 proc 
parameter mb_stats.
    I ran:
      git grep -n "/proc/fs/ext4" Documentation/
    and found that ext4 proc parameters are currently documented in both
    Documentation/admin-guide/ext4.rst and 
Documentation/filesystems/proc.rst.

    To be consistent with the existing documentation, I am thinking 
about documenting mb_stats in both places.
    If there are no objections, I will send a v3 shortly.
    Compared with v2,the v3 patch will add the mb_stats documentation to 
both ext4.rst and proc.rst.

    Regards,
    Baolin



在 2026/4/21 11:40, Ritesh Harjani (IBM) 写道:
> Andreas Dilger <adilger@dilger.ca> writes:
> 
>> On Apr 20, 2026, at 03:12, Ojaswin Mujoo <ojaswin@linux.ibm.com> wrote:
>>>
>>> On Sun, Apr 19, 2026 at 02:34:36PM +0800, Baolin Liu wrote:
>>>> From: Baolin Liu <liubaolin@kylinos.cn>
>>>>
>>>> Make /proc/fs/ext4/<dev>/mb_stats writable and clear the runtime
>>>> mballoc statistics when 0 is written.
>>>>
>>>> Signed-off-by: Baolin Liu <liubaolin@kylinos.cn>
>>>> ---
>>> Hi Baolin, thanks for the changes.
>>>
>>> Seems like userspace doesn't have any way to know that writing 0 will
>>> clear the that. Well, I guess if you are looking at this file you are
>>> anyways debugging kernel code so that should be fine
>>
>> That could be documented in Documentation/filesystems/ext4/allocators.rst,
>> or better would be to add a new file that covers mballoc in more detail.
>>
> 
> I started looking for ext4's control knobs for sys-admins in kernel
> Documentation where we should ideally document this, and I see those
> are declared here..
> 
> Documentation/admin-guide/ext4.rst
> Documentation/ABI/testing/sysfs-fs-ext4.rst
> 
> Looking at this and the relevant code, I see all /proc/ entries in ext4
> are all readable and sysfs entries for ext4 are mostly the control knobs
> which are declared in above admin guide.
> 
> But now this patch adds a control knob to /proc/fs/ext4/<dev>/mb_stats,
> to clear the stats :).
> 
> I guess we could have simply documented a new control knob value (e.g.
> "2") for clearing the stats via /sys/fs/ext4/<dev>/mb_stats itself or
> maybe even having mb_stats_clear file in sysfs wasn't bad either... But
> either ways, clearing the stats via the same procfs mb_stats file is not
> totally bad and I don't have a strong preference.
> 
> 
> For documenting this, we can add mb_stats entry under /proc section in
> Documentation/admin-guide/ext4.rst and document this change. Something
> like -
> 
>    mb_stats
>          reports runtime statistics from multiblock allocator (mballoc),
>          including allocation request counts, groups scanned,
>          per-criteria scan hits (cr_p2_aligned, cr_goal_fast,
>          cr_best_avail, cr_goal_slow, cr_any_free), groups / extents
>          scanned, goal hits, buddy bitmap generations, and preallocation
>          usage etc.
>          Writing 0 to this procfs file resets all counters to zero.
> 
> 
> -ritesh


  reply	other threads:[~2026-04-21  5:23 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-19  6:34 [PATCH v2 v2 0/2] add blocks_allocated to mb_stats and clear mb_stats Baolin Liu
2026-04-19  6:34 ` [PATCH v2 v2 1/2] ext4: add blocks_allocated to mb_stats output Baolin Liu
2026-04-19  9:19   ` Andreas Dilger
2026-04-20  9:13   ` Ojaswin Mujoo
2026-04-19  6:34 ` [PATCH v2 v2 2/2] ext4: allow clearing mballoc stats through mb_stats Baolin Liu
2026-04-19  9:23   ` Andreas Dilger
2026-04-20  9:12   ` Ojaswin Mujoo
2026-04-20 18:28     ` Andreas Dilger
2026-04-21  3:40       ` Ritesh Harjani
2026-04-21  5:22         ` liubaolin [this message]
2026-04-21  6:12           ` Ojaswin Mujoo
2026-04-21  7:07             ` liubaolin

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=9a2d25d3-219f-481c-afb8-083c8b9417c1@163.com \
    --to=liubaolin12138@163.com \
    --cc=adilger@dilger.ca \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liubaolin@kylinos.cn \
    --cc=ojaswin@linux.ibm.com \
    --cc=ritesh.list@gmail.com \
    --cc=tytso@mit.edu \
    --cc=wangguanyu@vivo.com \
    --cc=yi.zhang@huaweicloud.com \
    /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