From: SJ Park <sj@kernel.org>
To: Ravi Jonnalagadda <ravis.opensrc@gmail.com>
Cc: SJ Park <sj@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
Jonathan Corbet <corbet@lwn.net>,
Randy Dunlap <rdunlap@infradead.org>,
Shuah Khan <shuah@kernel.org>,
Shuah Khan <skhan@linuxfoundation.org>,
damon@lists.linux.dev, linux-doc@vger.kernel.org,
linux-kselftest@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [PATCH v2 00/27] mm/damon: let users report their data attribute findings
Date: Wed, 25 Nov 2026 18:04:15 -0800 [thread overview]
Message-ID: <20261126020416.87656-1-sj@kernel.org> (raw)
In-Reply-To: <CALa+Y14BNfdWH3yBY+ky1+Sb0YvRzW=gRcKKyGWWaBQkysPUkA@mail.gmail.com>
Hi Ravi,
On Wed, 25 Nov 2026 14:10:15 -0800 Ravi Jonnalagadda <ravis.opensrc@gmail.com> wrote:
> Hi SJ,
>
> I tested v2 as it is in mm-new, and wanted to share what I saw.
Thank you for sharing!
[...]
> 2. As the submit rate goes up, two things go wrong:
> - with matching=Y, the probe misses the report more and more
> often, although it is always there;
> - with matching=N, the probe matches more and more often, although
> it should never match.
> 3. Empty and inverted reports are accepted. They never match, but
> they take queue slots, and enough of them push the valid report
> out.
> 4. On a vaddr context the filter is accepted but has no effect.
>
> Where it comes from
>
> Case 2: a busy report queue (13/27, 14/27)
>
> When a lookup finds the report queue locked, for example by a submit,
> it answers "not found" rather than "don't know". For matching=Y that
> is a miss; for matching=N it is a match. The more writers, the busier
> the queue, and the more samples go wrong.
This is the expected result. The implementation is more strict for type
matching. If it is unclear, it says the type is not matched.
For example, if filter type is PGIDLE_SET and we cannot confirm it, it is
treated as not PGIDLE_SET. For example, DAMON could fail at confirming that if
it was unable to get the folio for the probing memory due to some races.
>
> The right answer here is 100 % of samples for matching=Y and 0 % for
> matching=N. What I measured (the last column is the share of submits
> refused as busy):
>
> writers matching=Y matching=N refused submits
> 1, one submit per ms 99.5 % 0.5 % 0.1 %
> 1, back to back 45.5 % 55.3 % 0.2 %
> 4, back to back 49.0 % 51.3 % 60.2 %
> 16, back to back 15.6 % 84.9 % 79.9 %
>
> The numbers vary somewhat between boots; the trend does not.
>
> Could a lookup that finds the queue busy skip that sample instead of
> counting it as a miss?
I agree that could reduce the error rate. But I concern if it could make the
behavior inconsistent.
In my humble opinion, , the user could work around this issue by not submitting
the report too frequently.
But the more important question is, if the user really need to do this kind of
frequent report submissions. I have no clue at the moment. If it turns out
so, we could improve kernel side.
One straightforward way would be introducing a complenting type. For example,
we introduced PGIDLE_UNSET to complement PGILDE_SET. We could add something
similar for REPORT_MADE, say, REPORT_UNMADE.
Yet more possible kernel side improvement would be making the report queue
synchronization be more robust to contentions.
>
> Cases 3 and 4: input checks
>
> Two smaller things, both about inputs that are accepted but cannot
> work:
>
> - Submit accepts a report whose start equals its end, or is above it
> (22/27, 23/27). It never matches but takes a queue slot: with 1000
> of them after a valid report, the valid one is found in only 4 % of
> samples. Return -EINVAL for these?
> - A vaddr context accepts a REPORT_MADE filter (16/27), but the vaddr
> operations never evaluate it. Refuse it for non-paddr contexts for
> now?
I agree this could be confusing. In a sense, that said, those are working as
documented. There is no documentation saying addr_start should be less than
addr_end. DAMOS filter design documentation mentions "support of the filter
types depends on the DAMON operations set". And the probe filter design
documentation says "The filters work the same as DAMOS filters".
I personally tend to prefer keeping code simple over making good user
experience, as long as it is not causing critical issues like crashes and/or
leaks.
If it turns out to really confuse users to be real problematic, we could add
documents or make code changes.
>
> A minor nit in the cover letter: the loop
> "echo submit > producer_state" runs in producers/, so it fails with
> "Permission denied". It should be "echo submit > 0/producer_state".
Good finding, thank you. Maybe we could ask Andrew to fix this up, but this
might be too minor thing that readers could easily find out themselves...?
Thank you again for your review and testing, Ravi!
Thanks,
SJ
[...]
next prev parent reply other threads:[~2026-11-26 2:04 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-24 15:36 [PATCH v2 00/27] mm/damon: let users report their data attribute findings SJ Park
2026-11-24 15:36 ` [PATCH v2 24/27] selftests/damon/sysfs.sh: add basic tests for admin/reports/ SJ Park
2026-11-25 22:10 ` [PATCH v2 00/27] mm/damon: let users report their data attribute findings Ravi Jonnalagadda
2026-11-26 2:04 ` SJ Park [this message]
2026-11-26 7:03 ` Ravi Jonnalagadda
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=20261126020416.87656-1-sj@kernel.org \
--to=sj@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=corbet@lwn.net \
--cc=damon@lists.linux.dev \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=ravis.opensrc@gmail.com \
--cc=rdunlap@infradead.org \
--cc=shuah@kernel.org \
--cc=skhan@linuxfoundation.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