From: SeongJae Park <sj@kernel.org>
To: Quanmin Yan <yanquanmin1@huawei.com>
Cc: SeongJae Park <sj@kernel.org>,
akpm@linux-foundation.org, damon@lists.linux.dev,
linux-kernel@vger.kernel.org, linux-mm@kvack.org,
wangkefeng.wang@huawei.com, zuoze1@huawei.com
Subject: Re: [RFC PATCH -next 15/16] mm/damon: the byte statistics data type in damos_stat uses unsigned long long
Date: Wed, 20 Aug 2025 12:57:21 -0700 [thread overview]
Message-ID: <20250820195721.85577-1-sj@kernel.org> (raw)
In-Reply-To: <3b5a37a7-af37-4108-a0c5-bc147bb77842@huawei.com>
On Wed, 20 Aug 2025 17:54:32 +0800 Quanmin Yan <yanquanmin1@huawei.com> wrote:
> Hi SJ,
>
> 在 2025/8/14 1:10, SeongJae Park 写道:
> > On Wed, 13 Aug 2025 13:07:05 +0800 Quanmin Yan <yanquanmin1@huawei.com> wrote:
> >
> >> For 32-bit systems, damos_stat now uses unsigned long long for byte
> >> statistics data to avoid integer overflow risks inherent in the
> >> previous design.
> > I suggested using the core-layer address unit on stat, and ask users to
> > multiply the addr_unit value to stat values if they want bytes value. If we
> > agree on it, I think this patch wouldn't really be required.
>
> Thank you for the guidance, I agree with your perspective. However, this patch doesn't actually belong in the addr_unit series, my apologies
> for the confusion. It is actually intended to address potential overflow issues
> in statistical data on 32-bit systems, and it is not directly related to addr_unit.
> This patch has been dropped from the v2 series.
>
> After introducing addr_unit, if it is set to a larger value, it can help mitigate
> the overflow issue. However, under the default setting of addr_unit=1, statistical
> data may still overflow after a sufficiently long runtime, for example, when sz_tried
> exceeds 4GB.
Thank you for clarifying this! My opinion is that, since we use core-layer
address unit for DAMOS stats, as long as users set appropriate addr_unit, I
think the overflow wouldn't really happen in real problematic ways?
For example, if addr_unit is 2**10 (=1024) and the scheme has tried to 4 *
2**30 bytes (4 GiB) of region, the sz_tried value will be 4 * 2**20, so far
from overflowing.
I think still the chance to overflow is higher than 64bit, but maybe the user
space tools can monitor and handle the overflow...? Maybe we can discuss
further, but let's focus on the essential part for now.
>
> Besides, please allow me to mention one point in advance: if addr is extended for
> use in modules(e.g. DAMON_RECLAIM, LRU_SORT) in the future, the term "bytes" in
> module_param_named(bytes_##try_name...), although multiplied by addr would yield
> the actual byte count, might cause confusion due to its seemingly direct naming.
Thank you for heasdup! I agree it could be confusing, but I have no real good
idea at the moment, sorry. Let's revisit after the essential part work is
done.
>
> Overall, this patch isn’t critically important at the moment, nor does it offer a
> sufficiently robust solution, but I’d still appreciate hearing your perspective on
> the matter — I’m all ears.
Thank you again for headsup of the remaining issues. Yes, let's keep eyes and
revisit those later.
Thanks,
SJ
next prev parent reply other threads:[~2025-08-20 19:57 UTC|newest]
Thread overview: 51+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-13 5:06 [RFC PATCH -next 00/16] mm/damon: support ARM32 with LPAE Quanmin Yan
2025-08-13 5:06 ` [RFC PATCH -next 01/16] mm/damon/core: add damon_ctx->addr_unit Quanmin Yan
2025-08-13 5:06 ` [RFC PATCH -next 02/16] mm/damon/paddr: support addr_unit for access monitoring Quanmin Yan
2025-08-13 5:06 ` [RFC PATCH -next 03/16] mm/damon/paddr: support addr_unit for DAMOS_PAGEOUT Quanmin Yan
2025-08-19 6:18 ` SeongJae Park
2025-08-19 6:26 ` SeongJae Park
2025-08-19 14:18 ` Quanmin Yan
2025-08-19 15:53 ` SeongJae Park
2025-08-13 5:06 ` [RFC PATCH -next 04/16] mm/damon/paddr: support addr_unit for DAMOS_LRU_[DE]PRIO Quanmin Yan
2025-08-19 6:19 ` SeongJae Park
2025-08-19 6:26 ` SeongJae Park
2025-08-13 5:06 ` [RFC PATCH -next 05/16] mm/damon/paddr: support addr_unit for MIGRATE_{HOT,COLD} Quanmin Yan
2025-08-19 6:21 ` SeongJae Park
2025-08-19 6:27 ` SeongJae Park
2025-08-13 5:06 ` [RFC PATCH -next 06/16] mm/damon/paddr: support addr_unit for DAMOS_STAT Quanmin Yan
2025-08-19 6:22 ` SeongJae Park
2025-08-19 6:27 ` SeongJae Park
2025-08-13 5:06 ` [RFC PATCH -next 07/16] mm/damon/sysfs: implement addr_unit file under context dir Quanmin Yan
2025-08-19 6:24 ` SeongJae Park
2025-08-19 14:45 ` Quanmin Yan
2025-08-19 15:56 ` SeongJae Park
2025-08-13 5:06 ` [RFC PATCH -next 08/16] Docs/mm/damon/design: document 'address unit' parameter Quanmin Yan
2025-08-13 5:06 ` [RFC PATCH -next 09/16] Docs/admin-guide/mm/damon/usage: document addr_unit file Quanmin Yan
2025-08-13 5:07 ` [RFC PATCH -next 10/16] Docs/ABI/damon: " Quanmin Yan
2025-08-13 5:07 ` [RFC PATCH -next 11/16] mm/damon: add addr_unit for DAMON_RECLAIM and LRU_SORT Quanmin Yan
2025-08-13 16:36 ` SeongJae Park
2025-08-14 12:59 ` Quanmin Yan
2025-08-14 16:11 ` SeongJae Park
2025-08-19 14:59 ` Quanmin Yan
2025-08-13 5:07 ` [RFC PATCH -next 12/16] mm/damon: add damon_ctx->min_region and damon_target->min_region Quanmin Yan
2025-08-13 16:49 ` SeongJae Park
2025-08-19 14:52 ` Quanmin Yan
2025-08-13 5:07 ` [RFC PATCH -next 13/16] mm/damon/sysfs: ensure valid addr_unit setting in damon_sysfs_apply_inputs() Quanmin Yan
2025-08-13 17:02 ` SeongJae Park
2025-08-20 8:45 ` Quanmin Yan
2025-08-13 5:07 ` [RFC PATCH -next 14/16] mm/damon/core: convert sz to byte units when updating state Quanmin Yan
2025-08-13 17:08 ` SeongJae Park
2025-08-20 10:10 ` Quanmin Yan
2025-08-13 5:07 ` [RFC PATCH -next 15/16] mm/damon: the byte statistics data type in damos_stat uses unsigned long long Quanmin Yan
2025-08-13 17:10 ` SeongJae Park
2025-08-20 9:54 ` Quanmin Yan
2025-08-20 19:57 ` SeongJae Park [this message]
2025-08-13 5:07 ` [RFC PATCH -next 16/16] mm/damon/core: handle quota->esz overflow issues Quanmin Yan
2025-08-13 17:15 ` SeongJae Park
2025-08-20 10:06 ` Quanmin Yan
2025-08-13 17:25 ` [RFC PATCH -next 00/16] mm/damon: support ARM32 with LPAE SeongJae Park
2025-08-14 0:57 ` SeongJae Park
2025-08-14 14:07 ` Quanmin Yan
2025-08-14 16:04 ` SeongJae Park
2025-08-20 10:19 ` Quanmin Yan
2025-08-13 17:28 ` SeongJae Park
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=20250820195721.85577-1-sj@kernel.org \
--to=sj@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=damon@lists.linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=wangkefeng.wang@huawei.com \
--cc=yanquanmin1@huawei.com \
--cc=zuoze1@huawei.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