Linux cgroups development
 help / color / mirror / Atom feed
* [PATCH] mm/memcontrol: remove unused memcg parameter in calculate_high_delay()
@ 2026-08-25 12:01 Hongfu Li
  2026-08-25 12:12 ` Michal Hocko
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Hongfu Li @ 2026-08-25 12:01 UTC (permalink / raw)
  To: hannes, mhocko, roman.gushchin, shakeel.butt, muchun.song, akpm
  Cc: cgroups, linux-mm, linux-kernel, hongfu.li, Hongfu Li

From: Hongfu Li <lihongfu@kylinos.cn>

The memcg argument of calculate_high_delay() is never referenced in
its function body. The delay calculation only depends on nr_pages
and max_overage, and both callers have already obtained max_overage
from the same memcg.

Drop this unused parameter and update the two call sites inside
__mem_cgroup_handle_over_high().

Signed-off-by: Hongfu Li <lihongfu@kylinos.cn>
---
 mm/memcontrol.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 11b85f4b6828..8bdb6988e7f0 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -2515,8 +2515,7 @@ static u64 swap_find_max_overage(struct mem_cgroup *memcg)
  * Get the number of jiffies that we should penalise a mischievous cgroup which
  * is exceeding its memory.high by checking both it and its ancestors.
  */
-static unsigned long calculate_high_delay(struct mem_cgroup *memcg,
-					  unsigned int nr_pages,
+static unsigned long calculate_high_delay(unsigned int nr_pages,
 					  u64 max_overage)
 {
 	unsigned long penalty_jiffies;
@@ -2594,10 +2593,10 @@ void __mem_cgroup_handle_over_high(gfp_t gfp_mask)
 	 * memory.high is breached and reclaim is unable to keep up. Throttle
 	 * allocators proactively to slow down excessive growth.
 	 */
-	penalty_jiffies = calculate_high_delay(memcg, nr_pages,
+	penalty_jiffies = calculate_high_delay(nr_pages,
 					       mem_find_max_overage(memcg));
 
-	penalty_jiffies += calculate_high_delay(memcg, nr_pages,
+	penalty_jiffies += calculate_high_delay(nr_pages,
 						swap_find_max_overage(memcg));
 
 	/*
-- 
2.54.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] mm/memcontrol: remove unused memcg parameter in calculate_high_delay()
  2026-08-25 12:01 [PATCH] mm/memcontrol: remove unused memcg parameter in calculate_high_delay() Hongfu Li
@ 2026-08-25 12:12 ` Michal Hocko
  2026-08-25 16:14 ` Gregory Price
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Michal Hocko @ 2026-08-25 12:12 UTC (permalink / raw)
  To: Hongfu Li
  Cc: hannes, roman.gushchin, shakeel.butt, muchun.song, akpm, cgroups,
	linux-mm, linux-kernel, Hongfu Li

On Tue 25-08-26 20:01:53, Hongfu Li wrote:
> From: Hongfu Li <lihongfu@kylinos.cn>
> 
> The memcg argument of calculate_high_delay() is never referenced in
> its function body. The delay calculation only depends on nr_pages
> and max_overage, and both callers have already obtained max_overage
> from the same memcg.
> 
> Drop this unused parameter and update the two call sites inside
> __mem_cgroup_handle_over_high().
> 
> Signed-off-by: Hongfu Li <lihongfu@kylinos.cn>

Acked-by: Michal Hocko <mhocko@suse.com>

Thanks!

> ---
>  mm/memcontrol.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> index 11b85f4b6828..8bdb6988e7f0 100644
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
> @@ -2515,8 +2515,7 @@ static u64 swap_find_max_overage(struct mem_cgroup *memcg)
>   * Get the number of jiffies that we should penalise a mischievous cgroup which
>   * is exceeding its memory.high by checking both it and its ancestors.
>   */
> -static unsigned long calculate_high_delay(struct mem_cgroup *memcg,
> -					  unsigned int nr_pages,
> +static unsigned long calculate_high_delay(unsigned int nr_pages,
>  					  u64 max_overage)
>  {
>  	unsigned long penalty_jiffies;
> @@ -2594,10 +2593,10 @@ void __mem_cgroup_handle_over_high(gfp_t gfp_mask)
>  	 * memory.high is breached and reclaim is unable to keep up. Throttle
>  	 * allocators proactively to slow down excessive growth.
>  	 */
> -	penalty_jiffies = calculate_high_delay(memcg, nr_pages,
> +	penalty_jiffies = calculate_high_delay(nr_pages,
>  					       mem_find_max_overage(memcg));
>  
> -	penalty_jiffies += calculate_high_delay(memcg, nr_pages,
> +	penalty_jiffies += calculate_high_delay(nr_pages,
>  						swap_find_max_overage(memcg));
>  
>  	/*
> -- 
> 2.54.0

-- 
Michal Hocko
SUSE Labs

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] mm/memcontrol: remove unused memcg parameter in calculate_high_delay()
  2026-08-25 12:01 [PATCH] mm/memcontrol: remove unused memcg parameter in calculate_high_delay() Hongfu Li
  2026-08-25 12:12 ` Michal Hocko
@ 2026-08-25 16:14 ` Gregory Price
  2026-08-26  0:26 ` SJ Park
  2026-08-26 18:35 ` Shakeel Butt
  3 siblings, 0 replies; 5+ messages in thread
From: Gregory Price @ 2026-08-25 16:14 UTC (permalink / raw)
  To: Hongfu Li
  Cc: hannes, mhocko, roman.gushchin, shakeel.butt, muchun.song, akpm,
	cgroups, linux-mm, linux-kernel, Hongfu Li

On Tue, Aug 25, 2026 at 08:01:53PM +0800, Hongfu Li wrote:
> From: Hongfu Li <lihongfu@kylinos.cn>
> 
> The memcg argument of calculate_high_delay() is never referenced in
> its function body. The delay calculation only depends on nr_pages
> and max_overage, and both callers have already obtained max_overage
> from the same memcg.
> 
> Drop this unused parameter and update the two call sites inside
> __mem_cgroup_handle_over_high().
> 
> Signed-off-by: Hongfu Li <lihongfu@kylinos.cn>

Reviewed-by: Gregory Price (Meta) <gourry@gourry.net>


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] mm/memcontrol: remove unused memcg parameter in calculate_high_delay()
  2026-08-25 12:01 [PATCH] mm/memcontrol: remove unused memcg parameter in calculate_high_delay() Hongfu Li
  2026-08-25 12:12 ` Michal Hocko
  2026-08-25 16:14 ` Gregory Price
@ 2026-08-26  0:26 ` SJ Park
  2026-08-26 18:35 ` Shakeel Butt
  3 siblings, 0 replies; 5+ messages in thread
From: SJ Park @ 2026-08-26  0:26 UTC (permalink / raw)
  To: Hongfu Li
  Cc: SJ Park, hannes, mhocko, roman.gushchin, shakeel.butt,
	muchun.song, akpm, cgroups, linux-mm, linux-kernel, Hongfu Li

On Tue, 25 Aug 2026 20:01:53 +0800 Hongfu Li <hongfu.li@linux.dev> wrote:

> From: Hongfu Li <lihongfu@kylinos.cn>
> 
> The memcg argument of calculate_high_delay() is never referenced in
> its function body. The delay calculation only depends on nr_pages
> and max_overage, and both callers have already obtained max_overage
> from the same memcg.
> 
> Drop this unused parameter and update the two call sites inside
> __mem_cgroup_handle_over_high().

Looks good cleanup to me.

> 
> Signed-off-by: Hongfu Li <lihongfu@kylinos.cn>

Reviewed-by: SJ Park <sj@kernel.org>


Thanks,
SJ

[...]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] mm/memcontrol: remove unused memcg parameter in calculate_high_delay()
  2026-08-25 12:01 [PATCH] mm/memcontrol: remove unused memcg parameter in calculate_high_delay() Hongfu Li
                   ` (2 preceding siblings ...)
  2026-08-26  0:26 ` SJ Park
@ 2026-08-26 18:35 ` Shakeel Butt
  3 siblings, 0 replies; 5+ messages in thread
From: Shakeel Butt @ 2026-08-26 18:35 UTC (permalink / raw)
  To: Hongfu Li
  Cc: hannes, mhocko, roman.gushchin, muchun.song, akpm, cgroups,
	linux-mm, linux-kernel, Hongfu Li

On Tue, Aug 25, 2026 at 08:01:53PM +0800, Hongfu Li wrote:
> From: Hongfu Li <lihongfu@kylinos.cn>
> 
> The memcg argument of calculate_high_delay() is never referenced in
> its function body. The delay calculation only depends on nr_pages
> and max_overage, and both callers have already obtained max_overage
> from the same memcg.
> 
> Drop this unused parameter and update the two call sites inside
> __mem_cgroup_handle_over_high().
> 
> Signed-off-by: Hongfu Li <lihongfu@kylinos.cn>

Acked-by: Shakeel Butt <shakeel.butt@linux.dev>


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-08-26 18:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-25 12:01 [PATCH] mm/memcontrol: remove unused memcg parameter in calculate_high_delay() Hongfu Li
2026-08-25 12:12 ` Michal Hocko
2026-08-25 16:14 ` Gregory Price
2026-08-26  0:26 ` SJ Park
2026-08-26 18:35 ` Shakeel Butt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox