diff options
| author | Peter Zijlstra <peterz@infradead.org> | 2026-05-19 12:18:01 +0200 |
|---|---|---|
| committer | Peter Zijlstra <peterz@infradead.org> | 2026-05-19 12:18:01 +0200 |
| commit | a26d9208c1376ac3877d9f12e697f83368e2af1c (patch) | |
| tree | 1f68b9ae26b8b88a7d1f24fea2a6df87e4c0fee5 /kernel/exit.c | |
| parent | dd29c017aed628076e915fe4cdfb5392fd4c5cab (diff) | |
| parent | c99b8593b060931c5a0a4b701689f8d6a2c00dbf (diff) | |
| download | lwn-a26d9208c1376ac3877d9f12e697f83368e2af1c.tar.gz lwn-a26d9208c1376ac3877d9f12e697f83368e2af1c.zip | |
Merge branch 'sched/cache'
Merge the cache aware balancer topic branch.
# Conflicts:
# kernel/sched/topology.c
Diffstat (limited to 'kernel/exit.c')
| -rw-r--r-- | kernel/exit.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/kernel/exit.c b/kernel/exit.c index 25e9cb6de7e7..c6e7047739b0 100644 --- a/kernel/exit.c +++ b/kernel/exit.c @@ -543,6 +543,32 @@ void mm_update_next_owner(struct mm_struct *mm) } #endif /* CONFIG_MEMCG */ +#if defined(CONFIG_SCHED_CACHE) && defined(CONFIG_NUMA_BALANCING) +/* + * Subtract the memory footprint of the current task from + * mm. + */ +static void exit_mm_sched_cache(struct mm_struct *mm) +{ + unsigned long fp, sub; + + if (!current->total_numa_faults) + return; + /* + * No lock protection due to performance considerations. + * Make sure mm->sc_stat.footprint does not become + * negative. + */ + fp = READ_ONCE(mm->sc_stat.footprint); + sub = min(fp, current->total_numa_faults); + WRITE_ONCE(mm->sc_stat.footprint, fp - sub); +} +#else +static inline void exit_mm_sched_cache(struct mm_struct *mm) +{ +} +#endif /* CONFIG_SCHED_CACHE CONFIG_NUMA_BALANCING */ + /* * Turn us into a lazy TLB process if we * aren't already.. @@ -554,6 +580,9 @@ static void exit_mm(void) exit_mm_release(current, mm); if (!mm) return; + + exit_mm_sched_cache(mm); + mmap_read_lock(mm); mmgrab_lazy_tlb(mm); BUG_ON(mm != current->active_mm); |
