From: "Zi Yan" <ziy@nvidia.com>
To: "Huang, Ying" <ying.huang@linux.alibaba.com>,
"Zhiteng Qiu" <qiuzhiteng@hygon.cn>
Cc: "Andrew Morton" <akpm@linux-foundation.org>,
"David Hildenbrand" <david@kernel.org>,
"Matthew Brost" <matthew.brost@intel.com>,
"Joshua Hahn" <joshua.hahnjy@gmail.com>,
"Byungchul Park" <byungchul@sk.com>,
"Gregory Price" <gourry@gourry.net>,
"Alistair Popple" <apopple@nvidia.com>,
"Xin Hao" <xhao@linux.alibaba.com>,
"Dave Hansen" <dave.hansen@linux.intel.com>, <linux-mm@kvack.org>,
<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2] mm/migrate: don't batch the TLB flush when there is nothing to batch
Date: Sun, 08 Nov 2026 09:42:25 -0500 [thread overview]
Message-ID: <DMPWPZ7OHL1N.30XGRVQNCKVFZ@nvidia.com> (raw)
In-Reply-To: <878q33wknc.fsf@DESKTOP-5N7EMDA>
On Sun Nov 8, 2026 at 7:52 AM EST, Huang, Ying wrote:
> Zhiteng Qiu <qiuzhiteng@hygon.cn> writes:
>
<snip>
>
> IMHO, the description above is a bit too long. Could you try to make it
> more concise?
I agree. It looks like AI generated.
>
>> Signed-off-by: Zhiteng Qiu <qiuzhiteng@hygon.cn>
>> ---
<snip>
>> @@ -1344,7 +1344,19 @@ static int migrate_folio_unmap(new_folio_t get_new_folio,
>> /* Establish migration ptes */
>> VM_BUG_ON_FOLIO(folio_test_anon(src) &&
>> !folio_test_ksm(src) && !anon_vma, src);
>> - try_to_migrate(src, mode == MIGRATE_ASYNC ? TTU_BATCH_FLUSH : 0);
>> + enum ttu_flags ttu = mode == MIGRATE_ASYNC ? TTU_BATCH_FLUSH : 0;
>> +
>> + /*
>> + * Batching only pays off when the rmap walk can meet more than
>> + * one PTE. A lone order-0 folio with a single mapping has
>> + * exactly one: batching it gains nothing, and it leaves
>> + * mm->tlb_flush_batched pending, so later page table changes
>> + * in this mm (e.g. NUMA scanning) flush the whole mm.
This comment can be simplified.
>> + */
>> + if (single_folio && !folio_test_large(src) &&
>> + !folio_maybe_mapped_shared(src))
>> + ttu &= ~TTU_BATCH_FLUSH;
>
> Is it possible to use a simplified version as below?
>
> enum ttu_flags ttu = 0;
>
> if (mode == MIGRATE_ASYNC &&
> (!single_folio || folio_mapcount(src) > 1))
LGTM, but I would keep folio_maybe_mapped_shared() to clarify the
intent. Would (!single_folio || folio_maybe_mapped_shared(src)) work?
> ttu = TTU_BATCH_FLUSH;
>
--
Best Regards,
Yan, Zi
prev parent reply other threads:[~2026-11-08 14:42 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-06 4:16 [PATCH] " Zhiteng Qiu
2026-11-06 9:37 ` Huang, Ying
2026-11-06 10:09 ` Zhiteng Qiu
2026-11-06 17:50 ` Zhiteng Qiu
2026-11-07 6:54 ` Huang, Ying
2026-11-07 11:07 ` Zhiteng Qiu
2026-11-07 12:22 ` Huang, Ying
2026-11-07 12:26 ` Huang, Ying
2026-11-07 14:34 ` [PATCH v2] " Zhiteng Qiu
2026-11-08 12:52 ` Huang, Ying
2026-11-08 14:42 ` Zi Yan [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=DMPWPZ7OHL1N.30XGRVQNCKVFZ@nvidia.com \
--to=ziy@nvidia.com \
--cc=akpm@linux-foundation.org \
--cc=apopple@nvidia.com \
--cc=byungchul@sk.com \
--cc=dave.hansen@linux.intel.com \
--cc=david@kernel.org \
--cc=gourry@gourry.net \
--cc=joshua.hahnjy@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=matthew.brost@intel.com \
--cc=qiuzhiteng@hygon.cn \
--cc=xhao@linux.alibaba.com \
--cc=ying.huang@linux.alibaba.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
all inboxes | Powered by JetHome®