Message ID | 20241202184154.19321-3-ryncsn@gmail.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | mm/swap_cgroup: remove global swap cgroup lock | expand |
On Mon, Dec 2, 2024 at 10:42 AM Kairui Song <ryncsn@gmail.com> wrote: > > From: Kairui Song <kasong@tencent.com> > > This function is never used after commit 6b611388b626 > ("memcg-v1: remove charge move code"). > > Signed-off-by: Kairui Song <kasong@tencent.com> Reviewed-by: Yosry Ahmed <yosryahmed@google.com> > --- > include/linux/swap_cgroup.h | 2 -- > mm/swap_cgroup.c | 29 ----------------------------- > 2 files changed, 31 deletions(-) > > diff --git a/include/linux/swap_cgroup.h b/include/linux/swap_cgroup.h > index ae73a87775b3..d521ad1c4164 100644 > --- a/include/linux/swap_cgroup.h > +++ b/include/linux/swap_cgroup.h > @@ -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); > diff --git a/mm/swap_cgroup.c b/mm/swap_cgroup.c > index f63d1aa072a1..1770b076f6b7 100644 > --- a/mm/swap_cgroup.c > +++ b/mm/swap_cgroup.c > @@ -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 > -- > 2.47.0 >
On Tue, Dec 03, 2024 at 02:41:52AM +0800, Kairui Song wrote: > From: Kairui Song <kasong@tencent.com> > > This function is never used after commit 6b611388b626 > ("memcg-v1: remove charge move code"). > > Signed-off-by: Kairui Song <kasong@tencent.com> Acked-by: Shakeel Butt <shakeel.butt@linux.dev>
On Tue, Dec 03, 2024 at 02:41:52AM +0800, Kairui Song wrote: > From: Kairui Song <kasong@tencent.com> > > This function is never used after commit 6b611388b626 > ("memcg-v1: remove charge move code"). > > Signed-off-by: Kairui Song <kasong@tencent.com> Reviewed-by: Roman Gushchin <roman.gushchin@linux.dev>
diff --git a/include/linux/swap_cgroup.h b/include/linux/swap_cgroup.h index ae73a87775b3..d521ad1c4164 100644 --- a/include/linux/swap_cgroup.h +++ b/include/linux/swap_cgroup.h @@ -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); diff --git a/mm/swap_cgroup.c b/mm/swap_cgroup.c index f63d1aa072a1..1770b076f6b7 100644 --- a/mm/swap_cgroup.c +++ b/mm/swap_cgroup.c @@ -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