linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] um/mm: remove redundant assignment of max_low_pfn
@ 2024-06-15  3:41 Wei Yang
  2024-06-15  8:17 ` Mike Rapoport
  2024-07-23  3:43 ` Wei Yang
  0 siblings, 2 replies; 3+ messages in thread
From: Wei Yang @ 2024-06-15  3:41 UTC (permalink / raw)
  To: richard, anton.ivanov, johannes
  Cc: linux-um, linux-mm, Wei Yang, Jeff Dike,
	Paolo 'Blaisorblade' Giarrusso, Alasdair G Kergon,
	Andrew Morton, Mike Rapoport, David Hildenbrand

Current calculation of max_low_pfn is introduced in commit af84eab20891
("[PATCH] uml: fix LVM crash"). It is intended to set max_low_pfn to the
same value as max_pfn.

But I am not sure why the max_pfn is set to totalram_pages, which
represents the number of usable pages in system instead of an absolute
page frame number. (The change history stops there.)

While we have already calculate it in setup_physmem(), so not necessary
to do it again.

Also this would help changing totalram_pages accounting, since we plan
to move the accounting into __free_pages_core(). With this change,
totalram_pages may not represent the total usable pages at this point,
since some pages would be deferred initialized.

Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
CC: Jeff Dike <jdike@linux.intel.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Cc: Alasdair G Kergon <agk@redhat.com>
CC: Andrew Morton <akpm@linux-foundation.org>
CC: Mike Rapoport (IBM) <rppt@kernel.org>
CC: David Hildenbrand <david@redhat.com>

---
v2: remove redundant assignment of max_low_pfn
---
 arch/um/kernel/mem.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/um/kernel/mem.c b/arch/um/kernel/mem.c
index ca91accd64fc..a5b4fe2ad931 100644
--- a/arch/um/kernel/mem.c
+++ b/arch/um/kernel/mem.c
@@ -73,7 +73,6 @@ void __init mem_init(void)
 
 	/* this will put all low memory onto the freelists */
 	memblock_free_all();
-	max_low_pfn = totalram_pages();
 	max_pfn = max_low_pfn;
 	kmalloc_ok = 1;
 }
-- 
2.34.1



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

* Re: [PATCH v2] um/mm: remove redundant assignment of max_low_pfn
  2024-06-15  3:41 [PATCH v2] um/mm: remove redundant assignment of max_low_pfn Wei Yang
@ 2024-06-15  8:17 ` Mike Rapoport
  2024-07-23  3:43 ` Wei Yang
  1 sibling, 0 replies; 3+ messages in thread
From: Mike Rapoport @ 2024-06-15  8:17 UTC (permalink / raw)
  To: Wei Yang
  Cc: richard, anton.ivanov, johannes, linux-um, linux-mm, Jeff Dike,
	Paolo 'Blaisorblade' Giarrusso, Alasdair G Kergon,
	Andrew Morton, David Hildenbrand

On Sat, Jun 15, 2024 at 03:41:50AM +0000, Wei Yang wrote:
> Current calculation of max_low_pfn is introduced in commit af84eab20891
> ("[PATCH] uml: fix LVM crash"). It is intended to set max_low_pfn to the
> same value as max_pfn.
> 
> But I am not sure why the max_pfn is set to totalram_pages, which
> represents the number of usable pages in system instead of an absolute
> page frame number. (The change history stops there.)
> 
> While we have already calculate it in setup_physmem(), so not necessary
> to do it again.
> 
> Also this would help changing totalram_pages accounting, since we plan
> to move the accounting into __free_pages_core(). With this change,
> totalram_pages may not represent the total usable pages at this point,
> since some pages would be deferred initialized.
> 
> Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
> CC: Jeff Dike <jdike@linux.intel.com>
> Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
> Cc: Alasdair G Kergon <agk@redhat.com>
> CC: Andrew Morton <akpm@linux-foundation.org>
> CC: Mike Rapoport (IBM) <rppt@kernel.org>
> CC: David Hildenbrand <david@redhat.com>

Acked-by: Mike Rapoport (IBM) <rppt@kernel.org>

> ---
> v2: remove redundant assignment of max_low_pfn
> ---
>  arch/um/kernel/mem.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/arch/um/kernel/mem.c b/arch/um/kernel/mem.c
> index ca91accd64fc..a5b4fe2ad931 100644
> --- a/arch/um/kernel/mem.c
> +++ b/arch/um/kernel/mem.c
> @@ -73,7 +73,6 @@ void __init mem_init(void)
>  
>  	/* this will put all low memory onto the freelists */
>  	memblock_free_all();
> -	max_low_pfn = totalram_pages();
>  	max_pfn = max_low_pfn;
>  	kmalloc_ok = 1;
>  }
> -- 
> 2.34.1
> 

-- 
Sincerely yours,
Mike.


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

* Re: [PATCH v2] um/mm: remove redundant assignment of max_low_pfn
  2024-06-15  3:41 [PATCH v2] um/mm: remove redundant assignment of max_low_pfn Wei Yang
  2024-06-15  8:17 ` Mike Rapoport
@ 2024-07-23  3:43 ` Wei Yang
  1 sibling, 0 replies; 3+ messages in thread
From: Wei Yang @ 2024-07-23  3:43 UTC (permalink / raw)
  To: Wei Yang
  Cc: richard, anton.ivanov, johannes, linux-um, linux-mm, Jeff Dike,
	Paolo 'Blaisorblade' Giarrusso, Alasdair G Kergon,
	Andrew Morton, Mike Rapoport, David Hildenbrand

Would someone pick up this one?

On Sat, Jun 15, 2024 at 03:41:50AM +0000, Wei Yang wrote:
>Current calculation of max_low_pfn is introduced in commit af84eab20891
>("[PATCH] uml: fix LVM crash"). It is intended to set max_low_pfn to the
>same value as max_pfn.
>
>But I am not sure why the max_pfn is set to totalram_pages, which
>represents the number of usable pages in system instead of an absolute
>page frame number. (The change history stops there.)
>
>While we have already calculate it in setup_physmem(), so not necessary
>to do it again.
>
>Also this would help changing totalram_pages accounting, since we plan
>to move the accounting into __free_pages_core(). With this change,
>totalram_pages may not represent the total usable pages at this point,
>since some pages would be deferred initialized.
>
>Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
>CC: Jeff Dike <jdike@linux.intel.com>
>Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
>Cc: Alasdair G Kergon <agk@redhat.com>
>CC: Andrew Morton <akpm@linux-foundation.org>
>CC: Mike Rapoport (IBM) <rppt@kernel.org>
>CC: David Hildenbrand <david@redhat.com>
>
>---
>v2: remove redundant assignment of max_low_pfn
>---
> arch/um/kernel/mem.c | 1 -
> 1 file changed, 1 deletion(-)
>
>diff --git a/arch/um/kernel/mem.c b/arch/um/kernel/mem.c
>index ca91accd64fc..a5b4fe2ad931 100644
>--- a/arch/um/kernel/mem.c
>+++ b/arch/um/kernel/mem.c
>@@ -73,7 +73,6 @@ void __init mem_init(void)
> 
> 	/* this will put all low memory onto the freelists */
> 	memblock_free_all();
>-	max_low_pfn = totalram_pages();
> 	max_pfn = max_low_pfn;
> 	kmalloc_ok = 1;
> }
>-- 
>2.34.1

-- 
Wei Yang
Help you, Help me


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

end of thread, other threads:[~2024-07-23  3:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-15  3:41 [PATCH v2] um/mm: remove redundant assignment of max_low_pfn Wei Yang
2024-06-15  8:17 ` Mike Rapoport
2024-07-23  3:43 ` Wei Yang

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