mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Arnd Bergmann" <arnd@arndb.de>
To: "zhijun.han" <hanzj.it@gmail.com>
Cc: Linux-Arch <linux-arch@vger.kernel.org>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm: swap the definition of CONFIG_SPARSEMEM_VMEMMAP and CONFIG_SPARSEMEM
Date: Fri, 04 Nov 2022 08:58:39 +0100	[thread overview]
Message-ID: <7383e5a2-5583-4d35-8a19-40a8c6f977ad@app.fastmail.com> (raw)
In-Reply-To: <20221104032808.24565-1-hanzj.it@gmail.com>

On Fri, Nov 4, 2022, at 04:28, zhijun.han wrote:
> CONFIG_SPARSEMEM_VMEMMAP depends on CONFIG_SPARSEMEM
> When CONFIG_SPARSEMEM_VMEMMAP is enabled,
> CONFIG_SPARSEMEM will be enabled too.
> Causes __pfn_to_page and __page_to_pfn to be overwritten
>
> Signed-off-by: zhijun.han <hanzj.it@gmail.com>

I'm sorry, but I don't follow the logic here. Your explanation
makes sense, but from your patch it appears that your are
introducing the problem that you explain, instead of fixing it.

> --- a/include/asm-generic/memory_model.h
> +++ b/include/asm-generic/memory_model.h
> @@ -19,12 +19,6 @@
>  #define __page_to_pfn(page)	((unsigned long)((page) - mem_map) + \
>  				 ARCH_PFN_OFFSET)
> 
> -#elif defined(CONFIG_SPARSEMEM_VMEMMAP)
> -
> -/* memmap is virtually contiguous.  */
> -#define __pfn_to_page(pfn)	(vmemmap + (pfn))
> -#define __page_to_pfn(page)	(unsigned long)((page) - vmemmap)
> -
>  #elif defined(CONFIG_SPARSEMEM)
>  /*
>   * Note: section's mem_map is encoded to reflect its start_pfn.

What I see in the existing code is that checking
CONFIG_SPARSEMEM_VMEMMAP first catches only the case where
both SPARSEMEM and SPARSEMEM_VMEMMAP are set, so the third
elseif case is not used. When you swap them around, we
always get the definition for the SPARSEMEM case, since the
third elseif is never reached.

     Arnd

  reply	other threads:[~2022-11-04  7:59 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-04  3:28 zhijun.han
2022-11-04  7:58 ` Arnd Bergmann [this message]
2022-11-04 13:04 ` kernel test robot
2022-11-04 13:14 ` kernel test robot
2022-11-04 13:45 ` kernel test robot

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=7383e5a2-5583-4d35-8a19-40a8c6f977ad@app.fastmail.com \
    --to=arnd@arndb.de \
    --cc=hanzj.it@gmail.com \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.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®