diff for duplicates of <20161011041916.GA30973@bbox> diff --git a/a/1.txt b/N1/1.txt index 6746315..7d919a0 100644 --- a/a/1.txt +++ b/N1/1.txt @@ -29,3 +29,53 @@ On Mon, Oct 10, 2016 at 08:57:40AM +0200, Vlastimil Babka wrote: Fair enough. How about this? + +>From 4a0b6a74ebf1af7f90720b0028da49e2e2a2b679 Mon Sep 17 00:00:00 2001 +From: Minchan Kim <minchan@kernel.org> +Date: Thu, 6 Oct 2016 13:38:35 +0900 +Subject: [PATCH] mm: don't steal highatomic pageblock + +In page freeing path, migratetype is racy so that a highorderatomic +page could free into non-highorderatomic free list. If that page +is allocated, VM can change the pageblock from higorderatomic to +something. In that case, highatomic pageblock accounting is broken +so it doesn't work(e.g., VM cannot reserve highorderatomic pageblocks +any more although it doesn't reach 1% limit). + +So, this patch prohibits the changing from highatomic to other type. +It's no problem because MIGRATE_HIGHATOMIC is not listed in fallback +array so stealing will only happen due to unexpected races which is +really rare. Also, such prohibiting keeps highatomic pageblock more +longer so it would be better for highorderatomic page allocation. + +Signed-off-by: Minchan Kim <minchan@kernel.org> +--- + mm/page_alloc.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/mm/page_alloc.c b/mm/page_alloc.c +index 55ad0229ebf3..79853b258211 100644 +--- a/mm/page_alloc.c ++++ b/mm/page_alloc.c +@@ -2154,7 +2154,8 @@ __rmqueue_fallback(struct zone *zone, unsigned int order, int start_migratetype) + + page = list_first_entry(&area->free_list[fallback_mt], + struct page, lru); +- if (can_steal) ++ if (can_steal && ++ get_pageblock_migratetype(page) != MIGRATE_HIGHATOMIC) + steal_suitable_fallback(zone, page, start_migratetype); + + /* Remove the page from the freelists */ +@@ -2555,7 +2556,8 @@ int __isolate_free_page(struct page *page, unsigned int order) + struct page *endpage = page + (1 << order) - 1; + for (; page < endpage; page += pageblock_nr_pages) { + int mt = get_pageblock_migratetype(page); +- if (!is_migrate_isolate(mt) && !is_migrate_cma(mt)) ++ if (!is_migrate_isolate(mt) && !is_migrate_cma(mt) ++ && mt != MIGRATE_HIGHATOMIC) + set_pageblock_migratetype(page, + MIGRATE_MOVABLE); + } +-- +2.7.4 diff --git a/a/content_digest b/N1/content_digest index 1c1f102..08f5f03 100644 --- a/a/content_digest +++ b/N1/content_digest @@ -45,6 +45,56 @@ "> \n" "\n" "Fair enough.\n" - How about this? + "How about this?\n" + "\n" + ">From 4a0b6a74ebf1af7f90720b0028da49e2e2a2b679 Mon Sep 17 00:00:00 2001\n" + "From: Minchan Kim <minchan@kernel.org>\n" + "Date: Thu, 6 Oct 2016 13:38:35 +0900\n" + "Subject: [PATCH] mm: don't steal highatomic pageblock\n" + "\n" + "In page freeing path, migratetype is racy so that a highorderatomic\n" + "page could free into non-highorderatomic free list. If that page\n" + "is allocated, VM can change the pageblock from higorderatomic to\n" + "something. In that case, highatomic pageblock accounting is broken\n" + "so it doesn't work(e.g., VM cannot reserve highorderatomic pageblocks\n" + "any more although it doesn't reach 1% limit).\n" + "\n" + "So, this patch prohibits the changing from highatomic to other type.\n" + "It's no problem because MIGRATE_HIGHATOMIC is not listed in fallback\n" + "array so stealing will only happen due to unexpected races which is\n" + "really rare. Also, such prohibiting keeps highatomic pageblock more\n" + "longer so it would be better for highorderatomic page allocation.\n" + "\n" + "Signed-off-by: Minchan Kim <minchan@kernel.org>\n" + "---\n" + " mm/page_alloc.c | 6 ++++--\n" + " 1 file changed, 4 insertions(+), 2 deletions(-)\n" + "\n" + "diff --git a/mm/page_alloc.c b/mm/page_alloc.c\n" + "index 55ad0229ebf3..79853b258211 100644\n" + "--- a/mm/page_alloc.c\n" + "+++ b/mm/page_alloc.c\n" + "@@ -2154,7 +2154,8 @@ __rmqueue_fallback(struct zone *zone, unsigned int order, int start_migratetype)\n" + " \n" + " \t\tpage = list_first_entry(&area->free_list[fallback_mt],\n" + " \t\t\t\t\t\tstruct page, lru);\n" + "-\t\tif (can_steal)\n" + "+\t\tif (can_steal &&\n" + "+\t\t\tget_pageblock_migratetype(page) != MIGRATE_HIGHATOMIC)\n" + " \t\t\tsteal_suitable_fallback(zone, page, start_migratetype);\n" + " \n" + " \t\t/* Remove the page from the freelists */\n" + "@@ -2555,7 +2556,8 @@ int __isolate_free_page(struct page *page, unsigned int order)\n" + " \t\tstruct page *endpage = page + (1 << order) - 1;\n" + " \t\tfor (; page < endpage; page += pageblock_nr_pages) {\n" + " \t\t\tint mt = get_pageblock_migratetype(page);\n" + "-\t\t\tif (!is_migrate_isolate(mt) && !is_migrate_cma(mt))\n" + "+\t\t\tif (!is_migrate_isolate(mt) && !is_migrate_cma(mt)\n" + "+\t\t\t\t&& mt != MIGRATE_HIGHATOMIC)\n" + " \t\t\t\tset_pageblock_migratetype(page,\n" + " \t\t\t\t\t\t\t MIGRATE_MOVABLE);\n" + " \t\t}\n" + "-- \n" + 2.7.4 -7d83cebbe63051cd98bc7a04a9b9118cd0d59cac726fb5655efe5052497bff51 +7c42cd04425c08311d110fda24214e8c03ade5b5effc1f4d7d13ff57730970c4
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.