mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dave Hansen <dave.hansen@intel.com>
To: Brendan Jackman <jackmanb@google.com>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
	Andy Lutomirski <luto@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Thomas Gleixner <tglx@kernel.org>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/3] x86/mm: simplify calculation of max_pfn_mapped
Date: Tue, 2 Jun 2026 14:39:45 -0700	[thread overview]
Message-ID: <cafe12e9-fa47-4e51-a9ce-52e5eb1170c2@intel.com> (raw)
In-Reply-To: <20260503-x86-init-cleanup-v2-2-bb690bd2477c@google.com>

On 5/3/26 06:04, Brendan Jackman wrote:
...
> Luckily, init_memory_mapping() avoids all these conditions. In that
> case, the return value is just paddr_end. And that value is already
> present, no need to depend on the confusing return value.

It feels like we should say something about split_mem_range() here. All
of the guaranteed non-fiddly behavior originates in there, right?

> diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c
> index ae3e9e0820153..1a6a6fc700bb5 100644
> --- a/arch/x86/mm/init.c
> +++ b/arch/x86/mm/init.c
> @@ -544,10 +544,11 @@ void __ref init_memory_mapping(unsigned long start,
>  	memset(mr, 0, sizeof(mr));
>  	nr_range = split_mem_range(mr, 0, start, end);
>  
> -	for (i = 0; i < nr_range; i++)
> -		paddr_last = kernel_physical_mapping_init(mr[i].start, mr[i].end,
> -							  mr[i].page_size_mask,
> -							  prot);
> +	for (i = 0; i < nr_range; i++) {
> +		kernel_physical_mapping_init(mr[i].start, mr[i].end,
> +					     mr[i].page_size_mask, prot);
> +		paddr_last = mr[i].end;
> +	}

I guess this is actually:

	for (i = 0; i < nr_range; i++)
		kernel_physical_mapping_init(...);

	paddr_last = mr[nr_range-1].end;

Right? But what you have is probably just as compact.

  reply	other threads:[~2026-06-02 21:39 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-03 13:04 [PATCH v2 0/3] x86/mm: some cleanups for pagetable setup code Brendan Jackman
2026-05-03 13:04 ` [PATCH v2 1/3] x86/mm: drop unused return from init_memory_mapping() Brendan Jackman
2026-06-02 21:30   ` Dave Hansen
2026-06-23 14:12   ` Marcel Busch
2026-05-03 13:04 ` [PATCH v2 2/3] x86/mm: simplify calculation of max_pfn_mapped Brendan Jackman
2026-06-02 21:39   ` Dave Hansen [this message]
2026-06-03 10:20     ` Brendan Jackman
2026-06-24 12:36       ` Brendan Jackman
2026-06-23 14:17   ` Marcel Busch
2026-05-03 13:04 ` [PATCH v2 3/3] x86/mm: drop unused returns from direct map setup functions Brendan Jackman
2026-06-02 21:40   ` Dave Hansen
2026-06-23 14:18   ` Marcel Busch
2026-05-27 12:40 ` [PATCH v2 0/3] x86/mm: some cleanups for pagetable setup code Brendan Jackman
2026-06-02 21:53 ` Dave Hansen

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=cafe12e9-fa47-4e51-a9ce-52e5eb1170c2@intel.com \
    --to=dave.hansen@intel.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=jackmanb@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=tglx@kernel.org \
    --cc=x86@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

Powered by JetHome