Merge tag 'arm64-perf' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux
[cascardo/linux.git] / mm / vmscan.c
index f87cfaa..b934223 100644 (file)
@@ -382,9 +382,8 @@ static unsigned long do_shrink_slab(struct shrink_control *shrinkctl,
  *
  * @memcg specifies the memory cgroup to target. If it is not NULL,
  * only shrinkers with SHRINKER_MEMCG_AWARE set will be called to scan
- * objects from the memory cgroup specified. Otherwise all shrinkers
- * are called, and memcg aware shrinkers are supposed to scan the
- * global list then.
+ * objects from the memory cgroup specified. Otherwise, only unaware
+ * shrinkers are called.
  *
  * @nr_scanned and @nr_eligible form a ratio that indicate how much of
  * the available objects should be scanned.  Page reclaim for example
@@ -404,7 +403,7 @@ static unsigned long shrink_slab(gfp_t gfp_mask, int nid,
        struct shrinker *shrinker;
        unsigned long freed = 0;
 
-       if (memcg && !memcg_kmem_online(memcg))
+       if (memcg && (!memcg_kmem_enabled() || !mem_cgroup_online(memcg)))
                return 0;
 
        if (nr_scanned == 0)
@@ -428,7 +427,13 @@ static unsigned long shrink_slab(gfp_t gfp_mask, int nid,
                        .memcg = memcg,
                };
 
-               if (memcg && !(shrinker->flags & SHRINKER_MEMCG_AWARE))
+               /*
+                * If kernel memory accounting is disabled, we ignore
+                * SHRINKER_MEMCG_AWARE flag and call all shrinkers
+                * passing NULL for memcg.
+                */
+               if (memcg_kmem_enabled() &&
+                   !!memcg != !!(shrinker->flags & SHRINKER_MEMCG_AWARE))
                        continue;
 
                if (!(shrinker->flags & SHRINKER_NUMA_AWARE))
@@ -633,11 +638,11 @@ static int __remove_mapping(struct address_space *mapping, struct page *page,
         * Note that if SetPageDirty is always performed via set_page_dirty,
         * and thus under tree_lock, then this ordering is not required.
         */
-       if (!page_freeze_refs(page, 2))
+       if (!page_ref_freeze(page, 2))
                goto cannot_free;
        /* note: atomic_cmpxchg in page_freeze_refs provides the smp_rmb */
        if (unlikely(PageDirty(page))) {
-               page_unfreeze_refs(page, 2);
+               page_ref_unfreeze(page, 2);
                goto cannot_free;
        }
 
@@ -699,7 +704,7 @@ int remove_mapping(struct address_space *mapping, struct page *page)
                 * drops the pagecache ref for us without requiring another
                 * atomic operation.
                 */
-               page_unfreeze_refs(page, 1);
+               page_ref_unfreeze(page, 1);
                return 1;
        }
        return 0;