aboutsummaryrefslogtreecommitdiff
path: root/mm/page_alloc.c
diff options
context:
space:
mode:
authorAlex Shi <alex.shi@linaro.org>2017-10-04 12:03:22 +0800
committerAlex Shi <alex.shi@linaro.org>2017-10-04 12:03:22 +0800
commitcda2b9481445e798669f00fb8275d595f1ff943f (patch)
treeb70f5c939c38f61ca7258746f125ddc901466508 /mm/page_alloc.c
parent9173606ce35faae345352f97cdae0579c3d05c4a (diff)
parent10def3a6779924f7bb130200b8b940caf2914111 (diff)
Merge tag 'v4.4.89' into linux-linaro-lsk-v4.4lsk-v4.4-17.09
This is the 4.4.89 stable release
Diffstat (limited to 'mm/page_alloc.c')
-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 badac96cb969..233a2c348a24 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -1741,13 +1741,25 @@ static void unreserve_highatomic_pageblock(const struct alloc_context *ac)
struct page, lru);
/*
- * 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