From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f53.google.com (mail-pj1-f53.google.com [209.85.216.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 87D3535979 for ; Tue, 21 Apr 2026 04:19:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.53 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776745182; cv=none; b=FVPz+Po1wsrX+vc8lHNRtx8yf9Js1gPK2NXwDU+vXMsIYXJK0xkuxTt9iITkJg0kjmPeJyAOpBFBPlrrVaxkVfMDjzEzf8H2onTjmTrOqqnnAGRe/lu4VQlvhBU8lmnL0PTzAJ8AgfyJqSO7nSXUY2S8jmRcsFdektKQiwDYSMI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776745182; c=relaxed/simple; bh=w2yz4pRvJusRCLwhR0p7hTkXkOrE7+cfb6N741pWs+Y=; h=From:To:Cc:Subject:In-Reply-To:Date:Message-ID:References; b=r0SqyDIuIAz8oheK7YItN84uOD0h6Jz7/3MoaS9E3w7yQAYBJ6uApwPERGR77VJPcH9Q/8/1U+t3pUXgOBMSGOsLXF+txpHQtwRhw3EAYzWl1I/VxgbRb5kBQuYpuyGazFOj4T3ioLZDInJnJugc723shiBCL1flNpck14whKB0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=lfOUwmSl; arc=none smtp.client-ip=209.85.216.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="lfOUwmSl" Received: by mail-pj1-f53.google.com with SMTP id 98e67ed59e1d1-362bb3260f1so165261a91.2 for ; Mon, 20 Apr 2026 21:19:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1776745181; x=1777349981; darn=vger.kernel.org; h=references:message-id:date:in-reply-to:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=1H9W578xLJdLW/spgO4oKmx4ftwOYlHFCjRa/9Ujn8M=; b=lfOUwmSlMOrDvCVvZM88rv6BKwe7Lp2wPVm/++trkAusM3f78/mY9eFDdq2Wre7qJ7 82UULrWSGmYexsXlgc7tcagp3I5ChbEVRkvwpVEHTMchvHPToJ06AL3LJutnHDrlEGX8 s2TI1casYqtc4/4YlhnxIv6Be2jRQOb5Pf7K7SSDRU0tYnuDEOlNHrtmg2rYkMcJLxkB TtCxkhImN4IhJ2cbJS9LvMi1XzDmjJuub6sf0zF13RRYAH8mpBfKQOH8sZhnpWHdwXG1 ERHTDGIlI6rBHFTUuKZ++BTqQQg2IyopHm5i6OPrkRuZjLpwb6meYp6UrNHHyXWrDvza W3dw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776745181; x=1777349981; h=references:message-id:date:in-reply-to:subject:cc:to:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=1H9W578xLJdLW/spgO4oKmx4ftwOYlHFCjRa/9Ujn8M=; b=gH0cz4EaySfkrqA28zmkynN4gpHLkRJ1hKykJw9qpq6mgolThNTiEnDLopyHXy0b25 LzknoIu1GsGcV1VRBUFIbPftx8mbat/Bn1C9ylI495rACursf8+dEhpXGphL9a7s9F89 aZgeIOpFHjrXR+Gpf5niy5lfGmiNvTG8uZgoS0CcRTBHdPOFf2wkvG9HXO9y6m/Q9IWL vxEQnC6ATyT0KD44Xs2m1rBH/bZyVBMtXSxJK/ENdI5W7kaPmZ1nuWSpJhtpyJzccq+4 4X+oAnOzx1X79tm3K9OIGuYdA+HUmqTFUCCyJDA5/EhONrG86ISx1/UO300Ip6KMntnx BGuw== X-Forwarded-Encrypted: i=1; AFNElJ+rI//Jo5IzV9mHa16SFmbMjoClb+GvdILwDDA7LbXhQz3/K0NS+1xRbQhraDyGG/9QSspBsgX+WB4FknA=@vger.kernel.org X-Gm-Message-State: AOJu0YwJ+MEzZkVrFeirgVdShVyFjMWyNRryyl2IYTNZ+W8H3Aty/rfX veZdJAUWdhePABLRgtzV/U49zLBUhIauXdS2KPETCRmLzGy2va6715oU X-Gm-Gg: AeBDietSjNUv5BUYWWFbrduWgTDDkXBvAEFZqhKah4QETPDkRCh6v9EV1gTapeWt5DH tTGe5mQReSH896sUNCqrN/OwMPZ5AHjE+Ko4M7PJ/RdjxmypWaXSziuJCfTOZgFfYIaDfQFK77y xsupvoAkdaUyID2oaykgL/SCEfbWDswfQ+82MMk/lV8aJX7S7MngB7Wg8O40yLH8pNPAzFsSjqh jp7siUhhtDQ1+VYznYk/7tJeGwZzAY8pWAbkmat7vemawUuvs4V+7u3+KjJkG3FXuR/1u9iVxkc nfde13LYtLm35Q5I5n+w2213yROTq2yQ3pbeB0aM9URMGN0/AcmEfb6Aj+0oi5f8GyW12CMSQ1d r2X51N2GZufowTJm9+mf6QAi1OCOwH0xZDKx6nhv+AswwBRl29/lBEwPgPYi4YMWoDl4HkzAiES UlUywaZ2CX6eABhHLlJHFvTgYsFk1nI+Ig X-Received: by 2002:a17:90b:4b86:b0:35b:e550:e68a with SMTP id 98e67ed59e1d1-361403b8367mr16468262a91.3.1776745180755; Mon, 20 Apr 2026 21:19:40 -0700 (PDT) Received: from pve-server ([49.205.216.49]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-36140fc575bsm12149029a91.4.2026.04.20.21.19.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Apr 2026 21:19:39 -0700 (PDT) From: Ritesh Harjani (IBM) To: Andreas Dilger , Ojaswin Mujoo Cc: Baolin Liu , tytso@mit.edu, wangguanyu@vivo.com, yi.zhang@huaweicloud.com, linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org, Baolin Liu Subject: Re: [PATCH v2 v2 2/2] ext4: allow clearing mballoc stats through mb_stats In-Reply-To: <4A904858-8611-42BC-B1BD-9679F284F8EE@dilger.ca> Date: Tue, 21 Apr 2026 09:10:35 +0530 Message-ID: <7bq1t1zg.ritesh.list@gmail.com> References: <20260419063436.17999-1-liubaolin12138@163.com> <20260419063436.17999-3-liubaolin12138@163.com> <4A904858-8611-42BC-B1BD-9679F284F8EE@dilger.ca> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Andreas Dilger writes: > On Apr 20, 2026, at 03:12, Ojaswin Mujoo wrote: >> >> On Sun, Apr 19, 2026 at 02:34:36PM +0800, Baolin Liu wrote: >>> From: Baolin Liu >>> >>> Make /proc/fs/ext4//mb_stats writable and clear the runtime >>> mballoc statistics when 0 is written. >>> >>> Signed-off-by: Baolin Liu >>> --- >> 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//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//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