mm/workingset.c: refactor workingset_init()
authorKirill Tkhai <[email protected]>
Fri, 17 Aug 2018 22:47:41 +0000 (15:47 -0700)
committerLinus Torvalds <[email protected]>
Fri, 17 Aug 2018 23:20:30 +0000 (16:20 -0700)
Use prealloc_shrinker()/register_shrinker_prepared() instead of
register_shrinker().  This will be used in next patch.

[[email protected]: v9]
Link: http://lkml.kernel.org/r/153112550112.4097.16606173020912323761.stgit@localhost.localdomain
Link: http://lkml.kernel.org/r/153063057666.1818.17625951186610808734.stgit@localhost.localdomain
Signed-off-by: Kirill Tkhai <[email protected]>
Acked-by: Vladimir Davydov <[email protected]>
Tested-by: Shakeel Butt <[email protected]>
Cc: Al Viro <[email protected]>
Cc: Andrey Ryabinin <[email protected]>
Cc: Chris Wilson <[email protected]>
Cc: Greg Kroah-Hartman <[email protected]>
Cc: Guenter Roeck <[email protected]>
Cc: "Huang, Ying" <[email protected]>
Cc: Johannes Weiner <[email protected]>
Cc: Josef Bacik <[email protected]>
Cc: Li RongQing <[email protected]>
Cc: Matthew Wilcox <[email protected]>
Cc: Matthias Kaehlcke <[email protected]>
Cc: Mel Gorman <[email protected]>
Cc: Michal Hocko <[email protected]>
Cc: Minchan Kim <[email protected]>
Cc: Philippe Ombredanne <[email protected]>
Cc: Roman Gushchin <[email protected]>
Cc: Sahitya Tummala <[email protected]>
Cc: Stephen Rothwell <[email protected]>
Cc: Tetsuo Handa <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: Waiman Long <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
mm/workingset.c

index 529480c21f931df1abe5ace034b265e9e2a7ea46..4e0b2523aae26d90de969cfb1e0d613aaeaeff55 100644 (file)
@@ -523,15 +523,16 @@ static int __init workingset_init(void)
        pr_info("workingset: timestamp_bits=%d max_order=%d bucket_order=%u\n",
               timestamp_bits, max_order, bucket_order);
 
-       ret = __list_lru_init(&shadow_nodes, true, &shadow_nodes_key);
+       ret = prealloc_shrinker(&workingset_shadow_shrinker);
        if (ret)
                goto err;
-       ret = register_shrinker(&workingset_shadow_shrinker);
+       ret = __list_lru_init(&shadow_nodes, true, &shadow_nodes_key);
        if (ret)
                goto err_list_lru;
+       register_shrinker_prepared(&workingset_shadow_shrinker);
        return 0;
 err_list_lru:
-       list_lru_destroy(&shadow_nodes);
+       free_prealloced_shrinker(&workingset_shadow_shrinker);
 err:
        return ret;
 }