mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Yang Shi <yang@os.amperecomputing.com>
To: Dev Jain <dev.jain@arm.com>,
	ryan.roberts@arm.com, will@kernel.org, catalin.marinas@arm.com,
	akpm@linux-foundation.org, Miko.Lenczewski@arm.com,
	scott@os.amperecomputing.com, cl@gentwo.org
Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/4] arm64: mm: support large block mapping when rodata=full
Date: Tue, 5 Aug 2025 17:10:01 -0700	[thread overview]
Message-ID: <c23f7ecf-78f6-4ec8-8f00-b92e98fa95a3@os.amperecomputing.com> (raw)
In-Reply-To: <da766ad7-143b-4c7c-b296-f18df8380643@os.amperecomputing.com>

>>
>> --- snip ---
>>
>> I'm afraid I'll have to agree with Ryan :) Looking at the signature 
>> of split_kernel_pgtable_mapping,
>> one would expect that this function splits all block mappings in this 
>> region. But that is just a
>> nit; it does not seem right to me that we are iterating over the 
>> entire space when we know *exactly* where
>> we have to make the split, just to save on pgd/p4d/pud loads - the 
>> effect of which is probably cancelled
>> out by unnecessary iterations your approach takes to skip the 
>> intermediate blocks.
>
> The implementation is aimed to reuse the split code for repainting. We 
> have to split all leaf mappings down to PTEs for repainting.
>
> Now Ryan suggested use pgtable walk API for repainting, it made the 
> duplicate code problem gone. We had some discussion in the other series.
>
>>
>> If we are concerned that most change_memory_common() operations are 
>> for a single page, then
>> we can do something like:
>>
>> unsigned long size = end - start;
>> bool end_split, start_split = false;
>>
>> if (start not aligned to block mapping)
>>     start_split = split(start);
>>
>> /*
>>  * split the end only if the start wasn't split, or
>>  * if it cannot be guaranteed that start and end lie
>>  * on the same contig block
>>  */
>> if (!start_split || (size > CONT_PTE_SIZE))
>>     end_split = split(end);
>
> Thanks for the suggestion. It works for some cases, but I don't think 
> it can work if the range is cross page table IIUC. For example, start 
> is in a PMD, but end is in another PMD.

I think we have to call split_mapping(end) if size is greater than page 
size, i.e.

split_mapping(start);
if (size > PAGE_SIZE)
     split_mapping(end);

This can avoid walking page table twice for page size range, which 
should be the most case in the current kernel.

Thanks,
Yang

>
> Regards,
> Yang
>
>>
>>
>>
>


  reply	other threads:[~2025-08-06  0:10 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-24 22:11 [v5 PATCH 0/4] arm64: support FEAT_BBM level 2 and " Yang Shi
2025-07-24 22:11 ` [PATCH 1/4] arm64: Enable permission change on arm64 kernel block mappings Yang Shi
2025-07-24 22:11 ` [PATCH 2/4] arm64: cpufeature: add AmpereOne to BBML2 allow list Yang Shi
2025-08-01 14:36   ` Ryan Roberts
2025-08-04 23:20   ` Christoph Lameter (Ampere)
2025-07-24 22:11 ` [PATCH 3/4] arm64: mm: support large block mapping when rodata=full Yang Shi
2025-07-29 12:34   ` Dev Jain
2025-08-05 21:28     ` Yang Shi
2025-08-06  0:10       ` Yang Shi [this message]
2025-08-01 14:35   ` Ryan Roberts
2025-08-04 10:07     ` Ryan Roberts
2025-08-05 18:53     ` Yang Shi
2025-08-06  7:20       ` Ryan Roberts
2025-08-07  0:44         ` Yang Shi
2025-07-24 22:11 ` [PATCH 4/4] arm64: mm: split linear mapping if BBML2 is not supported on secondary CPUs Yang Shi
2025-07-26 11:10   ` kernel test robot
2025-08-01 16:14   ` Ryan Roberts
2025-08-05 18:59     ` Yang Shi
2025-08-05  7:54   ` Ryan Roberts
2025-08-05 17:45     ` Yang Shi
  -- strict thread matches above, loose matches on Subject: below --
2025-05-31  2:41 [v4 PATCH 0/4] arm64: support FEAT_BBM level 2 and large block mapping when rodata=full Yang Shi
2025-05-31  2:41 ` [PATCH 3/4] arm64: mm: support " Yang Shi
2025-06-16 11:58   ` Ryan Roberts
2025-06-16 12:33     ` Ryan Roberts
2025-06-17 21:01       ` Yang Shi
2025-06-16 16:24   ` Ryan Roberts
2025-06-17 21:09     ` Yang Shi
2025-06-23 13:26       ` Ryan Roberts
2025-06-23 19:12         ` Yang Shi
2025-06-26 22:39         ` Yang Shi
2025-07-23 17:38         ` Dev Jain
2025-07-23 20:51           ` Yang Shi
2025-07-24 11:43             ` Dev Jain
2025-07-24 17:59               ` Yang Shi

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=c23f7ecf-78f6-4ec8-8f00-b92e98fa95a3@os.amperecomputing.com \
    --to=yang@os.amperecomputing.com \
    --cc=Miko.Lenczewski@arm.com \
    --cc=akpm@linux-foundation.org \
    --cc=catalin.marinas@arm.com \
    --cc=cl@gentwo.org \
    --cc=dev.jain@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ryan.roberts@arm.com \
    --cc=scott@os.amperecomputing.com \
    --cc=will@kernel.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

all inboxes | Powered by JetHome®