Skip to content

Commit 6d4a491

Browse files
mina86mszyprow
authored andcommitted
mm: page_alloc: change fallbacks array handling
This commit adds a row for MIGRATE_ISOLATE type to the fallbacks array which was missing from it. It also, changes the array traversal logic a little making MIGRATE_RESERVE an end marker. The letter change, removes the implicit MIGRATE_UNMOVABLE from the end of each row which was read by __rmqueue_fallback() function. Signed-off-by: Michal Nazarewicz <mina86@mina86.com> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Acked-by: Mel Gorman <mel@csn.ul.ie> Reviewed-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> Tested-by: Rob Clark <rob.clark@linaro.org> Tested-by: Ohad Ben-Cohen <ohad@wizery.com> Tested-by: Benjamin Gaignard <benjamin.gaignard@linaro.org> Tested-by: Robert Nelson <robertcnelson@gmail.com> Tested-by: Barry Song <Baohua.Song@csr.com>
1 parent 041d3a8 commit 6d4a491

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

‎mm/page_alloc.c‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -875,11 +875,12 @@ struct page *__rmqueue_smallest(struct zone *zone, unsigned int order,
875875
* This array describes the order lists are fallen back to when
876876
* the free lists for the desirable migrate type are depleted
877877
*/
878-
static int fallbacks[MIGRATE_TYPES][MIGRATE_TYPES-1] = {
878+
static int fallbacks[MIGRATE_TYPES][3] = {
879879
[MIGRATE_UNMOVABLE] = { MIGRATE_RECLAIMABLE, MIGRATE_MOVABLE, MIGRATE_RESERVE },
880880
[MIGRATE_RECLAIMABLE] = { MIGRATE_UNMOVABLE, MIGRATE_MOVABLE, MIGRATE_RESERVE },
881881
[MIGRATE_MOVABLE] = { MIGRATE_RECLAIMABLE, MIGRATE_UNMOVABLE, MIGRATE_RESERVE },
882-
[MIGRATE_RESERVE] = { MIGRATE_RESERVE, MIGRATE_RESERVE, MIGRATE_RESERVE }, /* Never used */
882+
[MIGRATE_RESERVE] = { MIGRATE_RESERVE }, /* Never used */
883+
[MIGRATE_ISOLATE] = { MIGRATE_RESERVE }, /* Never used */
883884
};
884885

885886
/*
@@ -974,12 +975,12 @@ __rmqueue_fallback(struct zone *zone, int order, int start_migratetype)
974975
/* Find the largest possible block of pages in the other list */
975976
for (current_order = MAX_ORDER-1; current_order >= order;
976977
--current_order) {
977-
for (i = 0; i < MIGRATE_TYPES - 1; i++) {
978+
for (i = 0;; i++) {
978979
migratetype = fallbacks[start_migratetype][i];
979980

980981
/* MIGRATE_RESERVE handled later if necessary */
981982
if (migratetype == MIGRATE_RESERVE)
982-
continue;
983+
break;
983984

984985
area = &(zone->free_area[current_order]);
985986
if (list_empty(&area->free_list[migratetype]))

0 commit comments

Comments
 (0)