public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mm: swap the definition of CONFIG_SPARSEMEM_VMEMMAP and CONFIG_SPARSEMEM
@ 2022-11-04  3:28 zhijun.han
  2022-11-04  7:58 ` Arnd Bergmann
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: zhijun.han @ 2022-11-04  3:28 UTC (permalink / raw)
  To: arnd; +Cc: linux-arch, linux-kernel, zhijun.han

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>
---
 include/asm-generic/memory_model.h | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/include/asm-generic/memory_model.h b/include/asm-generic/memory_model.h
index a2c8ed60233a..e06851e0b39e 100644
--- 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.
@@ -41,6 +35,12 @@
 	struct mem_section *__sec = __pfn_to_section(__pfn);	\
 	__section_mem_map_addr(__sec) + __pfn;		\
 })
+
+#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))
 #endif /* CONFIG_FLATMEM/SPARSEMEM */
 
 /*
-- 
2.37.0 (Apple Git-136)


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-11-04 13:47 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-04  3:28 [PATCH] mm: swap the definition of CONFIG_SPARSEMEM_VMEMMAP and CONFIG_SPARSEMEM zhijun.han
2022-11-04  7:58 ` Arnd Bergmann
2022-11-04 13:04 ` kernel test robot
2022-11-04 13:14 ` kernel test robot
2022-11-04 13:45 ` kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox