aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mm/percpu.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/mm/percpu.c b/mm/percpu.c
index 30e683f42861..7d038393d8f5 100644
--- a/mm/percpu.c
+++ b/mm/percpu.c
@@ -1959,6 +1959,7 @@ void free_percpu(void __percpu *ptr)
1959 struct pcpu_chunk *chunk; 1959 struct pcpu_chunk *chunk;
1960 unsigned long flags; 1960 unsigned long flags;
1961 int off; 1961 int off;
1962 bool need_balance = false;
1962 1963
1963 if (!ptr) 1964 if (!ptr)
1964 return; 1965 return;
@@ -1980,7 +1981,7 @@ void free_percpu(void __percpu *ptr)
1980 1981
1981 list_for_each_entry(pos, &pcpu_slot[pcpu_nr_slots - 1], list) 1982 list_for_each_entry(pos, &pcpu_slot[pcpu_nr_slots - 1], list)
1982 if (pos != chunk) { 1983 if (pos != chunk) {
1983 pcpu_schedule_balance_work(); 1984 need_balance = true;
1984 break; 1985 break;
1985 } 1986 }
1986 } 1987 }
@@ -1988,6 +1989,9 @@ void free_percpu(void __percpu *ptr)
1988 trace_percpu_free_percpu(chunk->base_addr, off, ptr); 1989 trace_percpu_free_percpu(chunk->base_addr, off, ptr);
1989 1990
1990 spin_unlock_irqrestore(&pcpu_lock, flags); 1991 spin_unlock_irqrestore(&pcpu_lock, flags);
1992
1993 if (need_balance)
1994 pcpu_schedule_balance_work();
1991} 1995}
1992EXPORT_SYMBOL_GPL(free_percpu); 1996EXPORT_SYMBOL_GPL(free_percpu);
1993 1997