Skip to contentSkip to conversation

um/mm: remove redundant assignment of max_low_pfn

PATCH Applied Wei Yang 2 participants 3 messages Jun 15, 2024 – Jul 23, 2024

Subsystems (2)
lore
Share & tools
lore

Wei Yang

author
#0 lore raw

PATCH v2 1/1 um/mm: remove redundant assignment of max_low_pfn

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.

CC Jeff Dike <[email protected]>
Cc Paolo 'Blaisorblade' Giarrusso <[email protected]>
Cc Alasdair G Kergon <[email protected]>
CC Andrew Morton <[email protected]>
CC Mike Rapoport (IBM) <[email protected]>
CC David Hildenbrand <[email protected]>

---
v2: remove redundant assignment of max_low_pfn

---
 arch/um/kernel/mem.c | 1 -
 1 file changed, 1 deletion(-)
arch/um/kernel/mem.c +0 -1
index ca91accd64fc..a5b4fe2ad931 100644
@@ -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;
 }
Signature · 1 line
2.34.1
Acked-by on v2 1/1
#1 lore raw
Quoted 16 lines · Wei Yang

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.

Quoted 7 lines
CC Jeff Dike <[email protected]>
Cc Paolo 'Blaisorblade' Giarrusso <[email protected]>
Cc Alasdair G Kergon <[email protected]>
CC Andrew Morton <[email protected]>
CC Mike Rapoport (IBM) <[email protected]>
CC David Hildenbrand <[email protected]>
Quoted 21 lines

---
v2: remove redundant assignment of max_low_pfn

---
 arch/um/kernel/mem.c | 1 -
 1 file changed, 1 deletion(-)
arch/um/kernel/mem.c +0 -1
index ca91accd64fc..a5b4fe2ad931 100644
@@ -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;
 }
Signature · 1 line
2.34.1
Signature · 2 lines
Sincerely yours,
Mike.
author
#2 lore raw
In reply to Wei Yang

Would someone pick up this one?

Quoted 44 lines · Wei Yang

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.

CC Jeff Dike <[email protected]>
Cc Paolo 'Blaisorblade' Giarrusso <[email protected]>
Cc Alasdair G Kergon <[email protected]>
CC Andrew Morton <[email protected]>
CC Mike Rapoport (IBM) <[email protected]>
CC David Hildenbrand <[email protected]>

---
v2: remove redundant assignment of max_low_pfn
---
arch/um/kernel/mem.c | 1 -

1 file changed, 1 deletion(-)
arch/um/kernel/mem.c +0 -1
index ca91accd64fc..a5b4fe2ad931 100644
@@ -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;
 }
Signature · 1 line
2.34.1
Signature · 2 lines
Wei Yang
Help you, Help me