diff options
author | Miaohe Lin <linmiaohe@huawei.com> | 2022-03-22 14:47:19 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2022-03-22 15:57:10 -0700 |
commit | d6aad2016a3f902153d7b8b7e02da2c7c50c10a4 (patch) | |
tree | d96c7f53b13a46c6d288c057d0608b24a3b0da32 /mm/memory_hotplug.c | |
parent | 2b6bf15f464620bbee08e8257d11f8f9f7f8725f (diff) | |
download | lwn-d6aad2016a3f902153d7b8b7e02da2c7c50c10a4.tar.gz lwn-d6aad2016a3f902153d7b8b7e02da2c7c50c10a4.zip |
mm/memory_hotplug: avoid calling zone_intersects() for ZONE_NORMAL
If zid reaches ZONE_NORMAL, the caller will always get the NORMAL zone no
matter what zone_intersects() returns. So we can save some possible cpu
cycles by avoid calling zone_intersects() for ZONE_NORMAL.
Link: https://lkml.kernel.org/r/20220207133643.23427-3-linmiaohe@huawei.com
Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Oscar Salvador <osalvador@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/memory_hotplug.c')
-rw-r--r-- | mm/memory_hotplug.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index 39da3812bf47..947ba4fc8124 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c @@ -823,7 +823,7 @@ static struct zone *default_kernel_zone_for_pfn(int nid, unsigned long start_pfn struct pglist_data *pgdat = NODE_DATA(nid); int zid; - for (zid = 0; zid <= ZONE_NORMAL; zid++) { + for (zid = 0; zid < ZONE_NORMAL; zid++) { struct zone *zone = &pgdat->node_zones[zid]; if (zone_intersects(zone, start_pfn, nr_pages)) |