summaryrefslogtreecommitdiff
path: root/mm
diff options
context:
space:
mode:
authorAlex Shi <alex.shi@linaro.org>2017-10-04 04:03:49 (GMT)
committerAlex Shi <alex.shi@linaro.org>2017-10-04 04:03:49 (GMT)
commita38b2dd146c0bba28633fe857f0c4626e0c691cc (patch)
tree2d81121c3690a36a3679bc78552067eee74c2c81 /mm
parent7ecc9777c5c76d7b31c376ffd4f59c4a85472a1b (diff)
parentd59dabdc4cb380b79c965af28cd4ba001f04834b (diff)
downloadlinux-a38b2dd146c0bba28633fe857f0c4626e0c691cc.tar.xz
Merge tag 'v4.9.52' into linux-linaro-lsk-v4.9
This is the 4.9.52 stable release
Diffstat (limited to 'mm')
-rw-r--r--mm/page_alloc.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 2abf8d5..7064aae 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -2100,13 +2100,25 @@ static void unreserve_highatomic_pageblock(const struct alloc_context *ac)
continue;
/*
- * It should never happen but changes to locking could
- * inadvertently allow a per-cpu drain to add pages
- * to MIGRATE_HIGHATOMIC while unreserving so be safe
- * and watch for underflows.
+ * In page freeing path, migratetype change is racy so
+ * we can counter several free pages in a pageblock
+ * in this loop althoug we changed the pageblock type
+ * from highatomic to ac->migratetype. So we should
+ * adjust the count once.
*/
- zone->nr_reserved_highatomic -= min(pageblock_nr_pages,
- zone->nr_reserved_highatomic);
+ if (get_pageblock_migratetype(page) ==
+ MIGRATE_HIGHATOMIC) {
+ /*
+ * It should never happen but changes to
+ * locking could inadvertently allow a per-cpu
+ * drain to add pages to MIGRATE_HIGHATOMIC
+ * while unreserving so be safe and watch for
+ * underflows.
+ */
+ zone->nr_reserved_highatomic -= min(
+ pageblock_nr_pages,
+ zone->nr_reserved_highatomic);
+ }
/*
* Convert to ac->migratetype and avoid the normal