Re: [PATCH] Docs/damon: add TLB flush policy document

From: KunWu Chan

Date: Tue Jun 09 2026 - 04:25:39 EST


On Sat, Jun 6, 2026 at 8:54 AM SeongJae Park <sj@xxxxxxxxxx> wrote:
>
> Hi Kunwu and Lian,
>
> On Fri, 5 Jun 2026 11:10:08 +0800 Kunwu Chan <kunwu.chan@xxxxxxxxx> wrote:
>
> > From: Kunwu Chan <kunwu.chan@xxxxxxxxx>
> >
> > DAMON avoids TLB flushes after clearing PTE Accessed bits for sampling.
> > The overhead was measured and found significant [1]. Production
> > workloads with large working sets flush TLB buffers naturally, so
> > accuracy impact is negligible.
> >
> > On systems with large TLB buffers and small test workloads, stale TLB
> > entries persist across sampling intervals and produce false negatives.
> > This comes up repeatedly on the mailing list and in private inquiries
> > [2][3].
> >
> > Add a document on the design decision, trade-offs, test environment
> > problems, and recommendations.
> >
> > Link: https://lore.kernel.org/20200403103059.12762-1-sjpark@xxxxxxxxxx [1]
> > Link: https://lore.kernel.org/20260117020731.226785-3-sj@xxxxxxxxxx [2]
> > Link: https://lore.kernel.org/all/20260526145034.91594-1-sj@xxxxxxxxxx [3]
>
> Thank you for this great patch!
>
> >
> > Co-developed-by: Wang Lian <lianux.mm@xxxxxxxxx>
> > Signed-off-by: Wang Lian <lianux.mm@xxxxxxxxx>
> > Signed-off-by: Kunwu Chan <kunwu.chan@xxxxxxxxx>
> > ---
> > Documentation/mm/damon/index.rst | 1 +
> > Documentation/mm/damon/tlb_flush.rst | 131 +++++++++++++++++++++++++++
> > 2 files changed, 132 insertions(+)
> > create mode 100644 Documentation/mm/damon/tlb_flush.rst
> >
> > diff --git a/Documentation/mm/damon/index.rst b/Documentation/mm/damon/index.rst
> > index 318f6a7bfea4..5e239437dab3 100644
> > --- a/Documentation/mm/damon/index.rst
> > +++ b/Documentation/mm/damon/index.rst
> > @@ -19,6 +19,7 @@ DAMON is a Linux kernel subsystem for efficient :ref:`data access monitoring
> >
> > faq
> > design
> > + tlb_flush
> > api
> > maintainer-profile
> >
> > diff --git a/Documentation/mm/damon/tlb_flush.rst b/Documentation/mm/damon/tlb_flush.rst
> > new file mode 100644
> [...]
>
> Great document! That said, it feels like a good complete article or a paper,
> rather than DAMON documentation that pursue to be short and essential. I feel
> like this fit more to be published in a blog like DAMON project blog [1], or
> news site like LWN. If you'd like to, please feel free to upload a PR or send
> patch for DAMON project blog source [2].
>
> Mainly due to the verbosity, as I above mentionedd, I'm not sure if the current
> shape of this patch is the best to be merged as is. I also find the background
> part of the document is a kind of duplicate of some information in design.rst.
> What about putting only essential information in a condensed way on the
> design.rst?
>
Thanks, SJ. I agree — this document reads more like an article than short docs.

I'll follow your suggestion and submit it as a blog post to the DAMON
project blog instead.

Will send a PR to [2] soon. Thanks for the clear guidance.

> [1] https://damonitor.github.io/site_about
> [2] https://github.com/damonitor/damonitor.github.io/tree/master/blog_src
>
>
> Thanks,
> SJ
>
> [...]