Skip to contentSkip to conversation

mm/memcontrol: remove unused memcg parameter in calculate_high_delay()

PATCH Applied Hongfu Li 5 participants 5 messages Aug 25 – Aug 26

Subsystems (3)
lore
Share & tools
lore

Hongfu Li

author
#0 lore raw

PATCH 1/1 mm/memcontrol: remove unused memcg parameter in calculate_high_delay()

From: Hongfu Li <[email protected]>

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().

---
 mm/memcontrol.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
mm/memcontrol.c +3 -4
index 11b85f4b6828..8bdb6988e7f0 100644
@@ -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));
 
 	/*
Signature · 1 line
2.54.0
Acked-by on v1 1/1
#1 lore raw
Quoted 11 lines · Hongfu Li

From: Hongfu Li <[email protected]>

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().

Thanks!

Quoted 33 lines
---
 mm/memcontrol.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
mm/memcontrol.c +3 -4
index 11b85f4b6828..8bdb6988e7f0 100644
@@ -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));
 
 	/*
Signature · 1 line
2.54.0
Signature · 2 lines
Michal Hocko
SUSE Labs
Reviewed-by on v1 1/1
#2 lore raw
In reply to Hongfu Li
Quoted 11 lines · Hongfu Li

From: Hongfu Li <[email protected]>

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().

Reviewed-by on v1 1/1
#3 lore raw
In reply to Hongfu Li
Quoted 9 lines · On Tue, 25 Aug 2026 20:01:53 +0800 Hongfu Li <[email protected]> wrote:

From: Hongfu Li <[email protected]>

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.

Quoted 2 lines

Thanks,
SJ

[...]

maintainer Acked-by on v1 1/1
#4 lore raw
In reply to Hongfu Li
Quoted 11 lines · Hongfu Li

From: Hongfu Li <[email protected]>

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().