* [PATCH] mm/page_alloc: remove realsize in free_area_init_core()
@ 2018-04-13 8:38 Wei Yang
2018-04-17 23:55 ` Andrew Morton
0 siblings, 1 reply; 2+ messages in thread
From: Wei Yang @ 2018-04-13 8:38 UTC (permalink / raw)
To: akpm, mhocko; +Cc: linux-mm, Wei Yang
Highmem's realsize always equals to freesize, so it is not necessary to
spare a variable to record this.
Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
---
mm/page_alloc.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 97fa99260822..c76eb609593f 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -6104,18 +6104,18 @@ static void __paginginit free_area_init_core(struct pglist_data *pgdat)
for (j = 0; j < MAX_NR_ZONES; j++) {
struct zone *zone = pgdat->node_zones + j;
- unsigned long size, realsize, freesize, memmap_pages;
+ unsigned long size, freesize, memmap_pages;
unsigned long zone_start_pfn = zone->zone_start_pfn;
size = zone->spanned_pages;
- realsize = freesize = zone->present_pages;
+ freesize = zone->present_pages;
/*
* Adjust freesize so that it accounts for how much memory
* is used by this zone for memmap. This affects the watermark
* and per-cpu initialisations
*/
- memmap_pages = calc_memmap_size(size, realsize);
+ memmap_pages = calc_memmap_size(size, freesize);
if (!is_highmem_idx(j)) {
if (freesize >= memmap_pages) {
freesize -= memmap_pages;
@@ -6147,7 +6147,7 @@ static void __paginginit free_area_init_core(struct pglist_data *pgdat)
* when the bootmem allocator frees pages into the buddy system.
* And all highmem pages will be managed by the buddy system.
*/
- zone->managed_pages = is_highmem_idx(j) ? realsize : freesize;
+ zone->managed_pages = freesize;
#ifdef CONFIG_NUMA
zone->node = nid;
#endif
--
2.15.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] mm/page_alloc: remove realsize in free_area_init_core()
2018-04-13 8:38 [PATCH] mm/page_alloc: remove realsize in free_area_init_core() Wei Yang
@ 2018-04-17 23:55 ` Andrew Morton
0 siblings, 0 replies; 2+ messages in thread
From: Andrew Morton @ 2018-04-17 23:55 UTC (permalink / raw)
To: Wei Yang; +Cc: mhocko, linux-mm
On Fri, 13 Apr 2018 16:38:59 +0800 Wei Yang <richard.weiyang@gmail.com> wrote:
> Highmem's realsize always equals to freesize, so it is not necessary to
> spare a variable to record this.
Agreed. The code seems a bit more fragile after this alteration, but I
guess the onus is on us, as always, to not screw it up later on. hm..
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-04-17 23:55 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-04-13 8:38 [PATCH] mm/page_alloc: remove realsize in free_area_init_core() Wei Yang
2018-04-17 23:55 ` Andrew Morton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).