* [PATCH -next] memcg: Remove inc/dec_lruvec_kmem_state helpers
@ 2025-11-26 2:04 Chen Ridong
2025-11-26 2:49 ` Qi Zheng
2025-11-26 16:34 ` Shakeel Butt
0 siblings, 2 replies; 3+ messages in thread
From: Chen Ridong @ 2025-11-26 2:04 UTC (permalink / raw)
To: hannes, mhocko, roman.gushchin, shakeel.butt, muchun.song, akpm,
david, zhengqi.arch, lorenzo.stoakes, axelrasmussen, yuanchu,
weixugc
Cc: cgroups, linux-mm, linux-kernel, lujialin4, chenridong
From: Chen Ridong <chenridong@huawei.com>
The dec_lruvec_kmem_state helper is unused by any caller and can be safely
removed. Meanwhile, the inc_lruvec_kmem_state helper is only referenced by
shadow_lru_isolate, retaining these two helpers is unnecessary. This patch
removes both helper functions to eliminate redundant code.
Signed-off-by: Chen Ridong <chenridong@huawei.com>
---
include/linux/memcontrol.h | 10 ----------
mm/workingset.c | 2 +-
2 files changed, 1 insertion(+), 11 deletions(-)
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index d35390f9892a..0651865a4564 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -1452,16 +1452,6 @@ struct slabobj_ext {
#endif
} __aligned(8);
-static inline void inc_lruvec_kmem_state(void *p, enum node_stat_item idx)
-{
- mod_lruvec_kmem_state(p, idx, 1);
-}
-
-static inline void dec_lruvec_kmem_state(void *p, enum node_stat_item idx)
-{
- mod_lruvec_kmem_state(p, idx, -1);
-}
-
static inline struct lruvec *parent_lruvec(struct lruvec *lruvec)
{
struct mem_cgroup *memcg;
diff --git a/mm/workingset.c b/mm/workingset.c
index 892f6fe94ea9..e9f05634747a 100644
--- a/mm/workingset.c
+++ b/mm/workingset.c
@@ -749,7 +749,7 @@ static enum lru_status shadow_lru_isolate(struct list_head *item,
if (WARN_ON_ONCE(node->count != node->nr_values))
goto out_invalid;
xa_delete_node(node, workingset_update_node);
- inc_lruvec_kmem_state(node, WORKINGSET_NODERECLAIM);
+ mod_lruvec_kmem_state(node, WORKINGSET_NODERECLAIM, 1);
out_invalid:
xa_unlock_irq(&mapping->i_pages);
--
2.34.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH -next] memcg: Remove inc/dec_lruvec_kmem_state helpers
2025-11-26 2:04 [PATCH -next] memcg: Remove inc/dec_lruvec_kmem_state helpers Chen Ridong
@ 2025-11-26 2:49 ` Qi Zheng
2025-11-26 16:34 ` Shakeel Butt
1 sibling, 0 replies; 3+ messages in thread
From: Qi Zheng @ 2025-11-26 2:49 UTC (permalink / raw)
To: Chen Ridong, hannes, mhocko, roman.gushchin, shakeel.butt,
muchun.song, akpm, david, lorenzo.stoakes, axelrasmussen,
yuanchu, weixugc
Cc: cgroups, linux-mm, linux-kernel, lujialin4, chenridong
On 11/26/25 10:04 AM, Chen Ridong wrote:
> From: Chen Ridong <chenridong@huawei.com>
>
> The dec_lruvec_kmem_state helper is unused by any caller and can be safely
> removed. Meanwhile, the inc_lruvec_kmem_state helper is only referenced by
> shadow_lru_isolate, retaining these two helpers is unnecessary. This patch
> removes both helper functions to eliminate redundant code.
Make sense.
Acked-by: Qi Zheng <zhengqi.arch@bytedance.com>
>
> Signed-off-by: Chen Ridong <chenridong@huawei.com>
> ---
> include/linux/memcontrol.h | 10 ----------
> mm/workingset.c | 2 +-
> 2 files changed, 1 insertion(+), 11 deletions(-)
>
> diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
> index d35390f9892a..0651865a4564 100644
> --- a/include/linux/memcontrol.h
> +++ b/include/linux/memcontrol.h
> @@ -1452,16 +1452,6 @@ struct slabobj_ext {
> #endif
> } __aligned(8);
>
> -static inline void inc_lruvec_kmem_state(void *p, enum node_stat_item idx)
> -{
> - mod_lruvec_kmem_state(p, idx, 1);
> -}
> -
> -static inline void dec_lruvec_kmem_state(void *p, enum node_stat_item idx)
> -{
> - mod_lruvec_kmem_state(p, idx, -1);
> -}
> -
> static inline struct lruvec *parent_lruvec(struct lruvec *lruvec)
> {
> struct mem_cgroup *memcg;
> diff --git a/mm/workingset.c b/mm/workingset.c
> index 892f6fe94ea9..e9f05634747a 100644
> --- a/mm/workingset.c
> +++ b/mm/workingset.c
> @@ -749,7 +749,7 @@ static enum lru_status shadow_lru_isolate(struct list_head *item,
> if (WARN_ON_ONCE(node->count != node->nr_values))
> goto out_invalid;
> xa_delete_node(node, workingset_update_node);
> - inc_lruvec_kmem_state(node, WORKINGSET_NODERECLAIM);
> + mod_lruvec_kmem_state(node, WORKINGSET_NODERECLAIM, 1);
>
> out_invalid:
> xa_unlock_irq(&mapping->i_pages);
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH -next] memcg: Remove inc/dec_lruvec_kmem_state helpers
2025-11-26 2:04 [PATCH -next] memcg: Remove inc/dec_lruvec_kmem_state helpers Chen Ridong
2025-11-26 2:49 ` Qi Zheng
@ 2025-11-26 16:34 ` Shakeel Butt
1 sibling, 0 replies; 3+ messages in thread
From: Shakeel Butt @ 2025-11-26 16:34 UTC (permalink / raw)
To: Chen Ridong
Cc: hannes, mhocko, roman.gushchin, muchun.song, akpm, david,
zhengqi.arch, lorenzo.stoakes, axelrasmussen, yuanchu, weixugc,
cgroups, linux-mm, linux-kernel, lujialin4, chenridong
On Wed, Nov 26, 2025 at 02:04:35AM +0000, Chen Ridong wrote:
> From: Chen Ridong <chenridong@huawei.com>
>
> The dec_lruvec_kmem_state helper is unused by any caller and can be safely
> removed. Meanwhile, the inc_lruvec_kmem_state helper is only referenced by
> shadow_lru_isolate, retaining these two helpers is unnecessary. This patch
> removes both helper functions to eliminate redundant code.
>
> Signed-off-by: Chen Ridong <chenridong@huawei.com>
Acked-by: Shakeel Butt <shakeel.butt@linux.dev>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-11-26 16:34 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-11-26 2:04 [PATCH -next] memcg: Remove inc/dec_lruvec_kmem_state helpers Chen Ridong
2025-11-26 2:49 ` Qi Zheng
2025-11-26 16:34 ` Shakeel Butt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox