提交 2a5cda5c 编写于 作者: L Liu Shixin 提交者: Zheng Zengkai

mm/page_alloc: fix counting of managed_pages

hulk inclusion
category: bugfix
bugzilla: 51887
CVE: NA

-------------------------------------------------

The commit f6366156 (mm/page_alloc.c: clear out zone->lowmem_reserve[]
if the zone is empty) clear out zone->lowmem_reserve[] if zone is empty.
But when zone is not empty and sysctl_lowmem_reserve_ratio[i] is set to zero,
zone_managed_pages(zone) is not counted in the managed_pages either. This is
inconsistent with the description of lowmen_reserve, so fix it.

Fixes: f6366156 ("mm/page_alloc.c: clear out zone->lowmem_reserve[] if the zone is empty")
Reported-by: Nyangerkun <yangerkun@huawei.com>
Signed-off-by: NLiu Shixin <liushixin2@huawei.com>
Reviewed-by: NKefeng Wang <wangkefeng.wang@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 b9742bda
...@@ -7796,14 +7796,14 @@ static void setup_per_zone_lowmem_reserve(void) ...@@ -7796,14 +7796,14 @@ static void setup_per_zone_lowmem_reserve(void)
unsigned long managed_pages = 0; unsigned long managed_pages = 0;
for (j = i + 1; j < MAX_NR_ZONES; j++) { for (j = i + 1; j < MAX_NR_ZONES; j++) {
if (clear) { struct zone *upper_zone = &pgdat->node_zones[j];
zone->lowmem_reserve[j] = 0;
} else { managed_pages += zone_managed_pages(upper_zone);
struct zone *upper_zone = &pgdat->node_zones[j];
managed_pages += zone_managed_pages(upper_zone); if (clear)
zone->lowmem_reserve[j] = 0;
else
zone->lowmem_reserve[j] = managed_pages / ratio; zone->lowmem_reserve[j] = managed_pages / ratio;
}
} }
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册