Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 339af29f authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "mm: prevent double decrease of nr_reserved_highatomic" into msm-4.9

parents 1d5b0b39 870f3455
Loading
Loading
Loading
Loading
+18 −6
Original line number Diff line number Diff line
@@ -2085,13 +2085,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.
			 */
			zone->nr_reserved_highatomic -= min(pageblock_nr_pages,
			 * 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.
			 */
			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