From: Lance Yang <lance.yang@linux.dev>
To: Baolin Wang <baolin.wang@linux.alibaba.com>
Cc: ioworker0@gmail.com, lorenzo.stoakes@oracle.com,
david@kernel.org, akpm@linux-foundation.org,
Liam.Howlett@oracle.com, vbabka@suse.cz, rppt@kernel.org,
surenb@google.com, mhocko@suse.com, ziy@nvidia.com,
npache@redhat.com, ryan.roberts@arm.com, dev.jain@arm.com,
baohua@kernel.org, linux-mm@kvack.org,
linux-kernel@vger.kernel.org,
"hughd@google.com" <hughd@google.com>
Subject: Re: [PATCH v1 1/1] mm/khugepaged: move tlb_remove_table_sync_one out from under PTL
Date: Fri, 16 Jan 2026 09:25:54 +0800 [thread overview]
Message-ID: <62e637cf-91e6-454d-a943-e5946bdf7784@linux.dev> (raw)
In-Reply-To: <26cb8bfa-67a7-43d8-b431-a3307df3e559@linux.alibaba.com>
On 2026/1/16 09:03, Baolin Wang wrote:
>
>
> On 1/15/26 8:28 PM, Lance Yang wrote:
>>
>>
>> On 2026/1/15 18:00, Baolin Wang wrote:
>>> Hi Lance,
>>>
>>> On 1/15/26 3:16 PM, Lance Yang wrote:
>>>> From: Lance Yang <lance.yang@linux.dev>
>>>>
>>>> tlb_remove_table_sync_one() sends IPIs to all CPUs and waits for them,
>>>> which we really don't want to do while holding PTL.
>>>
>>> Could you add more comments to explain why this is safe for the PAE
>>> case?
>>
>> Yep, IIUC, it is safe because we've already done pmdp_collapse_flush()
>> which ensures the PMD change is visible.
>>
>> pmdp_get_lockless_sync() (which calls tlb_remove_table_sync_one() on PAE)
>> is just to ensure any ongoing lockless pmd readers (e.g., GUP-fast)
>> complete
>> before we proceed. It sends IPIs to all CPUs and waits for responses -
>> a CPU
>> can only respond when it's not between local_irq_save() and
>> local_irq_restore().
>>
>> Moving it out from under PTL doesn't change the synchronization
>> semantics,
>> since lockless readers don't depend on PTL anyway.
>
> Cc Hugh who introduced the pmdp_get_lockless_sync(), to double check.
>
> Sounds reasonable to me, please add these comments into the commit
> message. Thanks.
Yes, will do. Thanks!
>
>>> For the non-PAE case, you added a new tlb_remove_table_sync_one(),
>>> why we need this (to solve what problem)? Please also add more
>>> comments to explain.
>>
>> Oops, you're right, the original macro was a no-op for non-PAE.
>>
>> I should just move the macro call out from under PTL, rather than
>> replacing it with direct tlb_remove_table_sync_one() calls.
>
> OK.
Cheers,
Lance
next prev parent reply other threads:[~2026-01-16 1:26 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-15 7:16 Lance Yang
2026-01-15 10:00 ` Baolin Wang
2026-01-15 12:28 ` Lance Yang
2026-01-16 1:03 ` Baolin Wang
2026-01-16 1:25 ` Lance Yang [this message]
2026-01-18 8:39 ` [PATCH v1 1/1] mm/khugepaged: move tlb_remove_table_sync_one out Lance Yang
2026-01-20 11:38 ` Lance Yang
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=62e637cf-91e6-454d-a943-e5946bdf7784@linux.dev \
--to=lance.yang@linux.dev \
--cc=Liam.Howlett@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=baohua@kernel.org \
--cc=baolin.wang@linux.alibaba.com \
--cc=david@kernel.org \
--cc=dev.jain@arm.com \
--cc=hughd@google.com \
--cc=ioworker0@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lorenzo.stoakes@oracle.com \
--cc=mhocko@suse.com \
--cc=npache@redhat.com \
--cc=rppt@kernel.org \
--cc=ryan.roberts@arm.com \
--cc=surenb@google.com \
--cc=vbabka@suse.cz \
--cc=ziy@nvidia.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