Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Qiliang Yuan <qiliang.yuan@linux.dev>
To: "Lorenzo Stoakes (ARM)" <ljs@kernel.org>
Cc: Qiliang Yuan <qiliang.yuan@linux.dev>,
	David Hildenbrand <david@kernel.org>,
	Rik van Riel <riel@surriel.com>,
	"Liam R. Howlett" <liam@infradead.org>,
	Vlastimil Babka <vbabka@kernel.org>, Harry Yoo <harry@kernel.org>,
	Jann Horn <jannh@google.com>, Lance Yang <lance.yang@linux.dev>,
	Andrew Morton <akpm@linux-foundation.org>,
	Matthew Wilcox <willy@infradead.org>,
	Kiryl Shutsemau <kas@kernel.org>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm/rmap: flush the TLB once per mapping in page_vma_mkclean_one()
Date: Mon, 23 Nov 2026 07:05:14 -0500	[thread overview]
Message-ID: <20261123120514.4141292-1-qiliang.yuan@linux.dev> (raw)
In-Reply-To: <awQo2tg9rzMJYCQe@gremlin>

On Mon, Nov 23, 2026 at 11:53:50AM +0000, Lorenzo Stoakes wrote:
> You are flooding the kernel with patches, 6 series across 4
> subsystems over 19 hrs:
[...]
> Given the volume both recently and in the past I assume you are using an LLM to
> do this, so could you confirm your understanding of the problem (as well as
> those of patches sent to other subsystems) and what real-world task you were
> doing to identify this issue?

Yes, I use an AI assistant. What it changed for me is mostly breadth: I
used to work in depth on one area of the kernel, and with the assistant
I can bring the same kind of algorithmic work to other paths and measure
it there. The patches stay small, a few to a few dozen lines each. I
test every change myself, with before/after measurements and the
relevant selftests, and debug kernels where it touches locking or
memory ordering, and I review the code line by line before sending it.
I don't send anything I don't understand, and I can explain every one
of them.

For this one, I was looking at how AI training jobs save checkpoints.
Writing a checkpoint through a shared mapping was 3-4x slower than
write(), and perf showed the writer spending about half of its time in
IPIs. Counting the callers of flush_tlb_mm_range() showed writeback's
folio_mkclean() flushing once per PTE in page_vma_mkclean_one(), so a
large folio mapped by PTEs costs one flush per page. The patch
write-protects the PTEs the way change_protection() does and flushes
the range once, before folio_mkclean() returns: stores through a stale
TLB entry land before writeback reads the folio, and later stores fault
and redirty it. Besides the timings in the changelog, I checked this
with writers storing through the mapping while another thread loops
fsync(), then compared the file with memory, on xfs and ext4 with 1 to
16 writers and on a KASAN/lockdep/DEBUG_VM kernel: no mismatch and no
warning.

I'd like to understand the concern better: is it the review load from
the number of postings, or something in these patches you think I may
have missed? If it is the former, I can space them out.

Thanks,
Qiliang


      reply	other threads:[~2026-11-23 12:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-23 10:41 [PATCH] mm/rmap: flush the TLB once per mapping in page_vma_mkclean_one() Qiliang Yuan
2026-11-23 11:53 ` Lorenzo Stoakes (ARM)
2026-11-23 12:05   ` Qiliang Yuan [this message]

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=20261123120514.4141292-1-qiliang.yuan@linux.dev \
    --to=qiliang.yuan@linux.dev \
    --cc=akpm@linux-foundation.org \
    --cc=david@kernel.org \
    --cc=harry@kernel.org \
    --cc=jannh@google.com \
    --cc=kas@kernel.org \
    --cc=lance.yang@linux.dev \
    --cc=liam@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=ljs@kernel.org \
    --cc=riel@surriel.com \
    --cc=vbabka@kernel.org \
    --cc=willy@infradead.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