diff options
-rw-r--r-- | include/linux/mmzone.h | 6 | ||||
-rw-r--r-- | mm/page_alloc.c | 13 |
2 files changed, 19 insertions, 0 deletions
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index bd791e452ad7..67ab5febabf7 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h | |||
@@ -490,6 +490,12 @@ struct zone { | |||
490 | unsigned long managed_pages; | 490 | unsigned long managed_pages; |
491 | 491 | ||
492 | /* | 492 | /* |
493 | * Number of MIGRATE_RESEVE page block. To maintain for just | ||
494 | * optimization. Protected by zone->lock. | ||
495 | */ | ||
496 | int nr_migrate_reserve_block; | ||
497 | |||
498 | /* | ||
493 | * rarely used fields: | 499 | * rarely used fields: |
494 | */ | 500 | */ |
495 | const char *name; | 501 | const char *name; |
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 5248fe070aa4..89d81f4429ca 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c | |||
@@ -3901,6 +3901,7 @@ static void setup_zone_migrate_reserve(struct zone *zone) | |||
3901 | struct page *page; | 3901 | struct page *page; |
3902 | unsigned long block_migratetype; | 3902 | unsigned long block_migratetype; |
3903 | int reserve; | 3903 | int reserve; |
3904 | int old_reserve; | ||
3904 | 3905 | ||
3905 | /* | 3906 | /* |
3906 | * Get the start pfn, end pfn and the number of blocks to reserve | 3907 | * Get the start pfn, end pfn and the number of blocks to reserve |
@@ -3922,6 +3923,12 @@ static void setup_zone_migrate_reserve(struct zone *zone) | |||
3922 | * future allocation of hugepages at runtime. | 3923 | * future allocation of hugepages at runtime. |
3923 | */ | 3924 | */ |
3924 | reserve = min(2, reserve); | 3925 | reserve = min(2, reserve); |
3926 | old_reserve = zone->nr_migrate_reserve_block; | ||
3927 | |||
3928 | /* When memory hot-add, we almost always need to do nothing */ | ||
3929 | if (reserve == old_reserve) | ||
3930 | return; | ||
3931 | zone->nr_migrate_reserve_block = reserve; | ||
3925 | 3932 | ||
3926 | for (pfn = start_pfn; pfn < end_pfn; pfn += pageblock_nr_pages) { | 3933 | for (pfn = start_pfn; pfn < end_pfn; pfn += pageblock_nr_pages) { |
3927 | if (!pfn_valid(pfn)) | 3934 | if (!pfn_valid(pfn)) |
@@ -3959,6 +3966,12 @@ static void setup_zone_migrate_reserve(struct zone *zone) | |||
3959 | reserve--; | 3966 | reserve--; |
3960 | continue; | 3967 | continue; |
3961 | } | 3968 | } |
3969 | } else if (!old_reserve) { | ||
3970 | /* | ||
3971 | * At boot time we don't need to scan the whole zone | ||
3972 | * for turning off MIGRATE_RESERVE. | ||
3973 | */ | ||
3974 | break; | ||
3962 | } | 3975 | } |
3963 | 3976 | ||
3964 | /* | 3977 | /* |