Skip to content

Commit

Permalink
mm/vmpressure: replace vmpressure_to_css() with vmpressure_to_memcg()
Browse files Browse the repository at this point in the history
We can get memcg directly form vmpr instead of vmpr->memcg->css->memcg, so
add a new func helper vmpressure_to_memcg().  And no code will use
vmpressure_to_css(), so delete it.

Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Hui Su <[email protected]>
Acked-by: Michal Hocko <[email protected]>
Acked-by: Chris Down <[email protected]>
Cc: Johannes Weiner <[email protected]>
Cc: Vladimir Davydov <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Hui Su authored and torvalds committed Sep 3, 2021
1 parent 20b51af commit 9647875
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion include/linux/vmpressure.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ extern void vmpressure_prio(gfp_t gfp, struct mem_cgroup *memcg, int prio);
extern void vmpressure_init(struct vmpressure *vmpr);
extern void vmpressure_cleanup(struct vmpressure *vmpr);
extern struct vmpressure *memcg_to_vmpressure(struct mem_cgroup *memcg);
extern struct cgroup_subsys_state *vmpressure_to_css(struct vmpressure *vmpr);
extern struct mem_cgroup *vmpressure_to_memcg(struct vmpressure *vmpr);
extern int vmpressure_register_event(struct mem_cgroup *memcg,
struct eventfd_ctx *eventfd,
const char *args);
Expand Down
4 changes: 2 additions & 2 deletions mm/memcontrol.c
Original file line number Diff line number Diff line change
Expand Up @@ -256,9 +256,9 @@ struct vmpressure *memcg_to_vmpressure(struct mem_cgroup *memcg)
return &memcg->vmpressure;
}

struct cgroup_subsys_state *vmpressure_to_css(struct vmpressure *vmpr)
struct mem_cgroup *vmpressure_to_memcg(struct vmpressure *vmpr)
{
return &container_of(vmpr, struct mem_cgroup, vmpressure)->css;
return container_of(vmpr, struct mem_cgroup, vmpressure);
}

#ifdef CONFIG_MEMCG_KMEM
Expand Down
3 changes: 1 addition & 2 deletions mm/vmpressure.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,7 @@ static struct vmpressure *work_to_vmpressure(struct work_struct *work)

static struct vmpressure *vmpressure_parent(struct vmpressure *vmpr)
{
struct cgroup_subsys_state *css = vmpressure_to_css(vmpr);
struct mem_cgroup *memcg = mem_cgroup_from_css(css);
struct mem_cgroup *memcg = vmpressure_to_memcg(vmpr);

memcg = parent_mem_cgroup(memcg);
if (!memcg)
Expand Down

0 comments on commit 9647875

Please sign in to comment.