Skip to content

Commit

Permalink
mm/swap_cgroup: remove swap_cgroup_cmpxchg
Browse files Browse the repository at this point in the history
This function is never used after commit 6b61138 ("memcg-v1: remove
charge move code").

Link: https://lkml.kernel.org/r/20241218114633.85196-3-ryncsn@gmail.com
Signed-off-by: Kairui Song <kasong@tencent.com>
Reviewed-by: Yosry Ahmed <yosryahmed@google.com>
Reviewed-by: Roman Gushchin <roman.gushchin@linux.dev>
Acked-by: Shakeel Butt <shakeel.butt@linux.dev>
Acked-by: Chris Li <chrisl@kernel.org>
Cc: Barry Song <baohua@kernel.org>
Cc: Hugh Dickins <hughd@google.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Michal Hocko <mhocko@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
  • Loading branch information
Kairui Song authored and Andrew Morton committed Jan 26, 2025
1 parent a53f311 commit 40733e7
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 31 deletions.
2 changes: 0 additions & 2 deletions include/linux/swap_cgroup.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@

#if defined(CONFIG_MEMCG) && defined(CONFIG_SWAP)

extern unsigned short swap_cgroup_cmpxchg(swp_entry_t ent,
unsigned short old, unsigned short new);
extern unsigned short swap_cgroup_record(swp_entry_t ent, unsigned short id,
unsigned int nr_ents);
extern unsigned short lookup_swap_cgroup_id(swp_entry_t ent);
Expand Down
29 changes: 0 additions & 29 deletions mm/swap_cgroup.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,35 +45,6 @@ static struct swap_cgroup *lookup_swap_cgroup(swp_entry_t ent,
return &ctrl->map[offset];
}

/**
* swap_cgroup_cmpxchg - cmpxchg mem_cgroup's id for this swp_entry.
* @ent: swap entry to be cmpxchged
* @old: old id
* @new: new id
*
* Returns old id at success, 0 at failure.
* (There is no mem_cgroup using 0 as its id)
*/
unsigned short swap_cgroup_cmpxchg(swp_entry_t ent,
unsigned short old, unsigned short new)
{
struct swap_cgroup_ctrl *ctrl;
struct swap_cgroup *sc;
unsigned long flags;
unsigned short retval;

sc = lookup_swap_cgroup(ent, &ctrl);

spin_lock_irqsave(&ctrl->lock, flags);
retval = sc->id;
if (retval == old)
sc->id = new;
else
retval = 0;
spin_unlock_irqrestore(&ctrl->lock, flags);
return retval;
}

/**
* swap_cgroup_record - record mem_cgroup for a set of swap entries
* @ent: the first swap entry to be recorded into
Expand Down

0 comments on commit 40733e7

Please sign in to comment.