From: Baolin Wang Date: Tue, 10 Jan 2023 13:36:22 +0000 (+0800) Subject: mm: compaction: avoid fragmentation score calculation for empty zones X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=9e5522715e6941bcfdc08d066a79d6da0f8cec8e;p=linux.git mm: compaction: avoid fragmentation score calculation for empty zones There is no need to calculate the fragmentation score for empty zones. Link: https://lkml.kernel.org/r/100331ad9d274a9725e687b00d85d75d7e4a17c7.1673342761.git.baolin.wang@linux.alibaba.com Signed-off-by: Baolin Wang Cc: Matthew Wilcox Signed-off-by: Andrew Morton --- diff --git a/mm/compaction.c b/mm/compaction.c index 0fd6c81a78099..b758b00a48854 100644 --- a/mm/compaction.c +++ b/mm/compaction.c @@ -2025,6 +2025,8 @@ static unsigned int fragmentation_score_node(pg_data_t *pgdat) struct zone *zone; zone = &pgdat->node_zones[zoneid]; + if (!populated_zone(zone)) + continue; score += fragmentation_score_zone_weighted(zone); }