Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "David Hildenbrand (Arm)" <david@kernel.org>
To: Xueyuan Chen <xueyuan.chen21@gmail.com>
Cc: dave.hansen@intel.com, akpm@linux-foundation.org,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, x86@kernel.org,
	catalin.marinas@arm.com, will@kernel.org, tglx@kernel.org,
	mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com,
	luto@kernel.org, peterz@infradead.org, hpa@zytor.com,
	ljs@kernel.org, liam@infradead.org, vbabka@kernel.org,
	rppt@kernel.org, surenb@google.com, mhocko@suse.com,
	ziy@nvidia.com, baolin.wang@linux.alibaba.com, npache@redhat.com,
	ryan.roberts@arm.com, dev.jain@arm.com, baohua@kernel.org,
	lance.yang@linux.dev, yang@os.amperecomputing.com,
	jannh@google.com
Subject: Re: [RFC PATCH v2 1/3] mm/huge_memory: make persistent huge zero folio read-only
Date: Fri, 19 Jun 2026 13:09:09 +0200	[thread overview]
Message-ID: <f679fc68-5ff6-4715-9a07-9eb3074b2d1e@kernel.org> (raw)
In-Reply-To: <20260619025553.226940-1-xueyuan.chen21@gmail.com>

On 6/19/26 04:55, Xueyuan Chen wrote:
> On Thu, Jun 18, 2026 at 02:36:25PM +0200, David Hildenbrand (Arm) wrote:
> 
> Hi, David
> 
> [...]
> 
>> Best to wait for some feedback.
> 
> Sure.
> 
>> I do wonder whether we want to pass an address instead of a page.
>>
>> https://lore.kernel.org/r/20260410151746.61150-2-kalyazin@amazon.com
>>
>> Wants to convert existing ones as well.
>>
>> That would imply that the caller must check for highmem.
>>
>> But then, we could just use existing set_memory_ro(), right?
>>
> 
> Agreed. Passing an address and reusing the existing set_memory_ro() 
> definitely makes things simpler.
> 
> However, there is an arm64 specific limitation:
> currently, the set_memory_r* api on arm64 only support the vmap
> region and do not handle linear map addresses.
> 
> If we go this route, should I extend the arm64 set_memory_r*
> implementation in the next version? The plan would be to make it check 
> for the bblm2 feature and modify the linear map PTEs accordingly.
> What do you think?

Good point! It's not really clear on which ranges set_memory*() is supposed to
work ...

arm64 only works on vmalloc/vmap, x86 and riscv on ordinary directmap ... what a
mess.

Having a new direct-map specific function with clear semantics might indeed
avoid even messing with that.

So, yeah, given that we have

	set_direct_map_invalid_noflush
	set_direct_map_default_noflush
	set_direct_map_valid_noflush

Let's add a

	set_direct_map_ro()

Or (my preference)

	change_direct_map_ro()

But given the existing naming scheme ... maybe just set_direct_map_ro() and
we'll clean this up another day.


Now, should there also be a "_noflush" in there, or who is supposed to flush the
TLB (or don't we flush at all, because it's used early during boot so far)?

In any case, for this function we should add excessive documentation and define
clear semantics.

-- 
Cheers,

David


  reply	other threads:[~2026-06-19 11:09 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-09 14:37 [RFC PATCH v2 0/3] make persistent huge zero folio read-only Xueyuan Chen
2026-06-09 14:37 ` [RFC PATCH v2 1/3] mm/huge_memory: " Xueyuan Chen
2026-06-09 19:33   ` Dave Hansen
2026-06-10  3:20     ` Lance Yang
2026-06-11  6:49       ` Mike Rapoport
2026-06-11 10:35         ` Lance Yang
2026-06-17 11:50     ` David Hildenbrand (Arm)
2026-06-17 14:15       ` Xueyuan Chen
2026-06-18  9:06         ` David Hildenbrand (Arm)
2026-06-18 11:48           ` Xueyuan Chen
2026-06-18 12:36             ` David Hildenbrand (Arm)
2026-06-19  2:55               ` Xueyuan Chen
2026-06-19 11:09                 ` David Hildenbrand (Arm) [this message]
2026-06-09 19:45   ` Andrew Morton
2026-06-10  2:15     ` Lance Yang
2026-06-11 11:28       ` David Hildenbrand (Arm)
2026-06-11 11:58         ` Lance Yang
2026-06-11 12:21           ` David Hildenbrand (Arm)
2026-06-11 12:50             ` Lance Yang
2026-06-09 14:38 ` [RFC PATCH v2 2/3] arm64/mm: make pages read-only in the linear map Xueyuan Chen
2026-06-09 14:38 ` [RFC PATCH v2 3/3] x86/mm: make pages read-only in the direct map Xueyuan Chen

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=f679fc68-5ff6-4715-9a07-9eb3074b2d1e@kernel.org \
    --to=david@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=baohua@kernel.org \
    --cc=baolin.wang@linux.alibaba.com \
    --cc=bp@alien8.de \
    --cc=catalin.marinas@arm.com \
    --cc=dave.hansen@intel.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=dev.jain@arm.com \
    --cc=hpa@zytor.com \
    --cc=jannh@google.com \
    --cc=lance.yang@linux.dev \
    --cc=liam@infradead.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=ljs@kernel.org \
    --cc=luto@kernel.org \
    --cc=mhocko@suse.com \
    --cc=mingo@redhat.com \
    --cc=npache@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rppt@kernel.org \
    --cc=ryan.roberts@arm.com \
    --cc=surenb@google.com \
    --cc=tglx@kernel.org \
    --cc=vbabka@kernel.org \
    --cc=will@kernel.org \
    --cc=x86@kernel.org \
    --cc=xueyuan.chen21@gmail.com \
    --cc=yang@os.amperecomputing.com \
    --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