@@ -399,29 +399,6 @@ void reset_isolation_suitable(pg_data_t *pgdat)
}
}
-/*
- * Sets the pageblock skip bit if it was clear. Note that this is a hint as
- * locks are not required for read/writers. Returns true if it was already set.
- */
-static bool test_and_set_skip(struct compact_control *cc, struct page *page,
- unsigned long pfn)
-{
- bool skip;
-
- /* Do no update if skip hint is being ignored */
- if (cc->ignore_skip_hint)
- return false;
-
- if (!IS_ALIGNED(pfn, pageblock_nr_pages))
- return false;
-
- skip = get_pageblock_skip(page);
- if (!skip && !cc->no_set_skip_hint)
- set_pageblock_skip(page);
-
- return skip;
-}
-
static void update_cached_migrate(struct compact_control *cc, unsigned long pfn)
{
struct zone *zone = cc->zone;
@@ -480,12 +457,6 @@ static inline void update_pageblock_skip(struct compact_control *cc,
static void update_cached_migrate(struct compact_control *cc, unsigned long pfn)
{
}
-
-static bool test_and_set_skip(struct compact_control *cc, struct page *page,
- unsigned long pfn)
-{
- return false;
-}
#endif /* CONFIG_COMPACTION */
/*
@@ -895,7 +866,6 @@ static bool too_many_isolated(pg_data_t *pgdat)
if (!valid_page && IS_ALIGNED(low_pfn, pageblock_nr_pages)) {
if (!cc->ignore_skip_hint && get_pageblock_skip(page)) {
low_pfn = end_pfn;
- page = NULL;
goto isolate_abort;
}
valid_page = page;
@@ -1021,11 +991,20 @@ static bool too_many_isolated(pg_data_t *pgdat)
lruvec_memcg_debug(lruvec, page);
- /* Try get exclusive access under lock */
- if (!skip_updated) {
+ /*
+ * Indicate that we want exclusive access to the
+ * rest of the pageblock.
+ *
+ * The LRU flag prevents simultaneous access to the
+ * first PFN, and the LRU lock helps to prevent
+ * simultaneous update of multiple pageblocks shared
+ * in the same bitmap.
+ */
+ if (page == valid_page) {
+ if (!cc->ignore_skip_hint &&
+ !cc->no_set_skip_hint)
+ set_pageblock_skip(page);
skip_updated = true;
- if (test_and_set_skip(cc, page, low_pfn))
- goto isolate_abort;
}
}
@@ -1098,15 +1077,9 @@ static bool too_many_isolated(pg_data_t *pgdat)
if (unlikely(low_pfn > end_pfn))
low_pfn = end_pfn;
- page = NULL;
-
isolate_abort:
if (lruvec)
unlock_page_lruvec_irqrestore(lruvec, flags);
- if (page) {
- SetPageLRU(page);
- put_page(page);
- }
/*
* Updated the cached scanner pfn once the pageblock has been scanned