]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
cpuset: clean up cpuset_node_allowed
authorHaifeng Xu <haifeng.xu@shopee.com>
Tue, 28 Feb 2023 08:35:37 +0000 (08:35 +0000)
committerAndrew Morton <akpm@linux-foundation.org>
Fri, 21 Apr 2023 23:07:57 +0000 (16:07 -0700)
Commit 002f290627c2 ("cpuset: use static key better and convert to new
API") used __cpuset_node_allowed() instead of cpuset_node_allowed() to
check whether we can allocate on a memory node.  Now this function isn't
used by anyone, so we can do the follow things to clean it up.

1. remove unused codes
2. rename __cpuset_node_allowed() to cpuset_node_allowed()
3. update comments in mm/page_alloc.c

Link: https://lkml.kernel.org/r/20230228083537.102665-1-haifeng.xu@shopee.com
Signed-off-by: Haifeng Xu <haifeng.xu@shopee.com>
Suggested-by: Waiman Long <longman@redhat.com>
Acked-by: Waiman Long <longman@redhat.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Tejun Heo <tj@kernel.org>
Cc: Zefan Li <lizefan.x@bytedance.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
include/linux/cpuset.h
kernel/cgroup/cpuset.c
mm/page_alloc.c

index d58e0476ee8e3be7a48d14d89c45d24438c684ca..980b76a1237ea17e1818b5360ec035b6a482151a 100644 (file)
@@ -80,18 +80,11 @@ extern nodemask_t cpuset_mems_allowed(struct task_struct *p);
 void cpuset_init_current_mems_allowed(void);
 int cpuset_nodemask_valid_mems_allowed(nodemask_t *nodemask);
 
-extern bool __cpuset_node_allowed(int node, gfp_t gfp_mask);
-
-static inline bool cpuset_node_allowed(int node, gfp_t gfp_mask)
-{
-       if (cpusets_enabled())
-               return __cpuset_node_allowed(node, gfp_mask);
-       return true;
-}
+extern bool cpuset_node_allowed(int node, gfp_t gfp_mask);
 
 static inline bool __cpuset_zone_allowed(struct zone *z, gfp_t gfp_mask)
 {
-       return __cpuset_node_allowed(zone_to_nid(z), gfp_mask);
+       return cpuset_node_allowed(zone_to_nid(z), gfp_mask);
 }
 
 static inline bool cpuset_zone_allowed(struct zone *z, gfp_t gfp_mask)
@@ -223,11 +216,6 @@ static inline int cpuset_nodemask_valid_mems_allowed(nodemask_t *nodemask)
        return 1;
 }
 
-static inline bool cpuset_node_allowed(int node, gfp_t gfp_mask)
-{
-       return true;
-}
-
 static inline bool __cpuset_zone_allowed(struct zone *z, gfp_t gfp_mask)
 {
        return true;
index 636f1c682ac07a86668b186e808c5b1b98f70a6b..0241b07d6f218494abacd4d57e82b73c98fdcf99 100644 (file)
@@ -3831,7 +3831,7 @@ static struct cpuset *nearest_hardwall_ancestor(struct cpuset *cs)
 }
 
 /*
- * __cpuset_node_allowed - Can we allocate on a memory node?
+ * cpuset_node_allowed - Can we allocate on a memory node?
  * @node: is this an allowed node?
  * @gfp_mask: memory allocation flags
  *
@@ -3870,7 +3870,7 @@ static struct cpuset *nearest_hardwall_ancestor(struct cpuset *cs)
  *     GFP_KERNEL   - any node in enclosing hardwalled cpuset ok
  *     GFP_USER     - only nodes in current tasks mems allowed ok.
  */
-bool __cpuset_node_allowed(int node, gfp_t gfp_mask)
+bool cpuset_node_allowed(int node, gfp_t gfp_mask)
 {
        struct cpuset *cs;              /* current cpuset ancestors */
        bool allowed;                   /* is allocation in zone z allowed? */
index 6da423ec356f9e3ce8b1df8a5d7ef76467386f3e..9de2a18519a10bb4cd112dd975478d626b255821 100644 (file)
@@ -3385,7 +3385,7 @@ get_page_from_freelist(gfp_t gfp_mask, unsigned int order, int alloc_flags,
 retry:
        /*
         * Scan zonelist, looking for a zone with enough free.
-        * See also __cpuset_node_allowed() comment in kernel/cgroup/cpuset.c.
+        * See also cpuset_node_allowed() comment in kernel/cgroup/cpuset.c.
         */
        no_fallback = alloc_flags & ALLOC_NOFRAGMENT;
        z = ac->preferred_zoneref;
@@ -4059,7 +4059,7 @@ gfp_to_alloc_flags(gfp_t gfp_mask, unsigned int order)
                /*
                 * Ignore cpuset mems for non-blocking __GFP_HIGH (probably
                 * GFP_ATOMIC) rather than fail, see the comment for
-                * __cpuset_node_allowed().
+                * cpuset_node_allowed().
                 */
                if (alloc_flags & ALLOC_MIN_RESERVE)
                        alloc_flags &= ~ALLOC_CPUSET;