diff mbox series

move max_page and total_pages to common code

Message ID f1653f8f-a2e3-5c91-0401-b5ab14415c86@suse.com (mailing list archive)
State New, archived
Headers show
Series move max_page and total_pages to common code | expand

Commit Message

Jan Beulich Aug. 8, 2023, 10:47 a.m. UTC
Common code references both, so the variables shouldn't need declaring
and defining by every arch. While moving the definitions, add
__read_mostly (__ro_after_init would only be appropriate when
!mem_hotplug).

Signed-off-by: Jan Beulich <jbeulich@suse.com>

Comments

Andrew Cooper Aug. 8, 2023, 10:59 a.m. UTC | #1
On 08/08/2023 11:47 am, Jan Beulich wrote:
> Common code references both, so the variables shouldn't need declaring
> and defining by every arch. While moving the definitions, add
> __read_mostly (__ro_after_init would only be appropriate when
> !mem_hotplug).
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
Julien Grall Aug. 9, 2023, 11:12 a.m. UTC | #2
Hi Jan,

On 08/08/2023 11:47, Jan Beulich wrote:
> Common code references both, so the variables shouldn't need declaring
> and defining by every arch. While moving the definitions, add
> __read_mostly (__ro_after_init would only be appropriate when
> !mem_hotplug).
> 
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Acked-by: Julien Grall <jgrall@amazon.com>

Cheers,

> 
> --- a/xen/arch/arm/include/asm/mm.h
> +++ b/xen/arch/arm/include/asm/mm.h
> @@ -198,9 +198,6 @@ extern unsigned long directmap_base_pdx;
>   /* PDX of the first page in the frame table. */
>   extern unsigned long frametable_base_pdx;
>   
> -extern unsigned long max_page;
> -extern unsigned long total_pages;
> -
>   #define PDX_GROUP_SHIFT SECOND_SHIFT
>   
>   /* Boot-time pagetable setup */
> --- a/xen/arch/arm/mm.c
> +++ b/xen/arch/arm/mm.c
> @@ -134,9 +134,6 @@ unsigned long directmap_base_pdx __read_
>   unsigned long frametable_base_pdx __read_mostly;
>   unsigned long frametable_virt_end __read_mostly;
>   
> -unsigned long max_page;
> -unsigned long total_pages;
> -
>   extern char __init_begin[], __init_end[];
>   
>   /* Checking VA memory layout alignment. */
> --- a/xen/arch/x86/include/asm/mm.h
> +++ b/xen/arch/x86/include/asm/mm.h
> @@ -337,8 +337,6 @@ struct page_info
>   #define maddr_get_owner(ma)   (page_get_owner(maddr_to_page((ma))))
>   
>   #define frame_table ((struct page_info *)FRAMETABLE_VIRT_START)
> -extern unsigned long max_page;
> -extern unsigned long total_pages;
>   void init_frametable(void);
>   
>   #define PDX_GROUP_SHIFT L2_PAGETABLE_SHIFT
> --- a/xen/arch/x86/mm.c
> +++ b/xen/arch/x86/mm.c
> @@ -146,10 +146,6 @@ l1_pgentry_t __section(".bss.page_aligne
>   l1_pgentry_t __section(".bss.page_aligned") __aligned(PAGE_SIZE)
>       l1_fixmap_x[L1_PAGETABLE_ENTRIES];
>   
> -/* Frame table size in pages. */
> -unsigned long max_page;
> -unsigned long total_pages;
> -
>   bool __read_mostly machine_to_phys_mapping_valid;
>   
>   struct rangeset *__read_mostly mmio_ro_ranges;
> --- a/xen/common/page_alloc.c
> +++ b/xen/common/page_alloc.c
> @@ -162,6 +162,8 @@
>   #define PGT_TYPE_INFO_INITIALIZER 0
>   #endif
>   
> +unsigned long __read_mostly max_page;
> +unsigned long __read_mostly total_pages;
>   paddr_t __ro_after_init mem_hotplug;
>   
>   /*
> --- a/xen/include/xen/mm.h
> +++ b/xen/include/xen/mm.h
> @@ -159,6 +159,8 @@ int assign_page(
>   /* Dump info to serial console */
>   void arch_dump_shared_mem_info(void);
>   
> +extern unsigned long max_page;
> +extern unsigned long total_pages;
>   extern paddr_t mem_hotplug;
>   
>   /*
diff mbox series

Patch

--- a/xen/arch/arm/include/asm/mm.h
+++ b/xen/arch/arm/include/asm/mm.h
@@ -198,9 +198,6 @@  extern unsigned long directmap_base_pdx;
 /* PDX of the first page in the frame table. */
 extern unsigned long frametable_base_pdx;
 
-extern unsigned long max_page;
-extern unsigned long total_pages;
-
 #define PDX_GROUP_SHIFT SECOND_SHIFT
 
 /* Boot-time pagetable setup */
--- a/xen/arch/arm/mm.c
+++ b/xen/arch/arm/mm.c
@@ -134,9 +134,6 @@  unsigned long directmap_base_pdx __read_
 unsigned long frametable_base_pdx __read_mostly;
 unsigned long frametable_virt_end __read_mostly;
 
-unsigned long max_page;
-unsigned long total_pages;
-
 extern char __init_begin[], __init_end[];
 
 /* Checking VA memory layout alignment. */
--- a/xen/arch/x86/include/asm/mm.h
+++ b/xen/arch/x86/include/asm/mm.h
@@ -337,8 +337,6 @@  struct page_info
 #define maddr_get_owner(ma)   (page_get_owner(maddr_to_page((ma))))
 
 #define frame_table ((struct page_info *)FRAMETABLE_VIRT_START)
-extern unsigned long max_page;
-extern unsigned long total_pages;
 void init_frametable(void);
 
 #define PDX_GROUP_SHIFT L2_PAGETABLE_SHIFT
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -146,10 +146,6 @@  l1_pgentry_t __section(".bss.page_aligne
 l1_pgentry_t __section(".bss.page_aligned") __aligned(PAGE_SIZE)
     l1_fixmap_x[L1_PAGETABLE_ENTRIES];
 
-/* Frame table size in pages. */
-unsigned long max_page;
-unsigned long total_pages;
-
 bool __read_mostly machine_to_phys_mapping_valid;
 
 struct rangeset *__read_mostly mmio_ro_ranges;
--- a/xen/common/page_alloc.c
+++ b/xen/common/page_alloc.c
@@ -162,6 +162,8 @@ 
 #define PGT_TYPE_INFO_INITIALIZER 0
 #endif
 
+unsigned long __read_mostly max_page;
+unsigned long __read_mostly total_pages;
 paddr_t __ro_after_init mem_hotplug;
 
 /*
--- a/xen/include/xen/mm.h
+++ b/xen/include/xen/mm.h
@@ -159,6 +159,8 @@  int assign_page(
 /* Dump info to serial console */
 void arch_dump_shared_mem_info(void);
 
+extern unsigned long max_page;
+extern unsigned long total_pages;
 extern paddr_t mem_hotplug;
 
 /*