Skip to content

Commit 8e46452

Browse files
hfxsphtejun
authored andcommitted
cpuset: Clean up cpuset_node_allowed
Commit 002f290 ("cpuset: use static key better and convert to new API") has 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 up it. 1. remove unused codes 2. rename __cpuset_node_allowed() to cpuset_node_allowed() 3. update comments in mm/page_alloc.c Suggested-by: Waiman Long <longman@redhat.com> Signed-off-by: Haifeng Xu <haifeng.xu@shopee.com> Acked-by: Waiman Long <longman@redhat.com> Signed-off-by: Tejun Heo <tj@kernel.org>
1 parent 4cdb91b commit 8e46452

3 files changed

Lines changed: 6 additions & 18 deletions

File tree

include/linux/cpuset.h

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -80,18 +80,11 @@ extern nodemask_t cpuset_mems_allowed(struct task_struct *p);
8080
void cpuset_init_current_mems_allowed(void);
8181
int cpuset_nodemask_valid_mems_allowed(nodemask_t *nodemask);
8282

83-
extern bool __cpuset_node_allowed(int node, gfp_t gfp_mask);
84-
85-
static inline bool cpuset_node_allowed(int node, gfp_t gfp_mask)
86-
{
87-
if (cpusets_enabled())
88-
return __cpuset_node_allowed(node, gfp_mask);
89-
return true;
90-
}
83+
extern bool cpuset_node_allowed(int node, gfp_t gfp_mask);
9184

9285
static inline bool __cpuset_zone_allowed(struct zone *z, gfp_t gfp_mask)
9386
{
94-
return __cpuset_node_allowed(zone_to_nid(z), gfp_mask);
87+
return cpuset_node_allowed(zone_to_nid(z), gfp_mask);
9588
}
9689

9790
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)
223216
return 1;
224217
}
225218

226-
static inline bool cpuset_node_allowed(int node, gfp_t gfp_mask)
227-
{
228-
return true;
229-
}
230-
231219
static inline bool __cpuset_zone_allowed(struct zone *z, gfp_t gfp_mask)
232220
{
233221
return true;

kernel/cgroup/cpuset.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3831,7 +3831,7 @@ static struct cpuset *nearest_hardwall_ancestor(struct cpuset *cs)
38313831
}
38323832

38333833
/*
3834-
* __cpuset_node_allowed - Can we allocate on a memory node?
3834+
* cpuset_node_allowed - Can we allocate on a memory node?
38353835
* @node: is this an allowed node?
38363836
* @gfp_mask: memory allocation flags
38373837
*
@@ -3870,7 +3870,7 @@ static struct cpuset *nearest_hardwall_ancestor(struct cpuset *cs)
38703870
* GFP_KERNEL - any node in enclosing hardwalled cpuset ok
38713871
* GFP_USER - only nodes in current tasks mems allowed ok.
38723872
*/
3873-
bool __cpuset_node_allowed(int node, gfp_t gfp_mask)
3873+
bool cpuset_node_allowed(int node, gfp_t gfp_mask)
38743874
{
38753875
struct cpuset *cs; /* current cpuset ancestors */
38763876
bool allowed; /* is allocation in zone z allowed? */

mm/page_alloc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4217,7 +4217,7 @@ get_page_from_freelist(gfp_t gfp_mask, unsigned int order, int alloc_flags,
42174217
retry:
42184218
/*
42194219
* Scan zonelist, looking for a zone with enough free.
4220-
* See also __cpuset_node_allowed() comment in kernel/cgroup/cpuset.c.
4220+
* See also cpuset_node_allowed() comment in kernel/cgroup/cpuset.c.
42214221
*/
42224222
no_fallback = alloc_flags & ALLOC_NOFRAGMENT;
42234223
z = ac->preferred_zoneref;
@@ -4891,7 +4891,7 @@ gfp_to_alloc_flags(gfp_t gfp_mask, unsigned int order)
48914891
/*
48924892
* Ignore cpuset mems for non-blocking __GFP_HIGH (probably
48934893
* GFP_ATOMIC) rather than fail, see the comment for
4894-
* __cpuset_node_allowed().
4894+
* cpuset_node_allowed().
48954895
*/
48964896
if (alloc_flags & ALLOC_MIN_RESERVE)
48974897
alloc_flags &= ~ALLOC_CPUSET;

0 commit comments

Comments
 (0)