mirror of
https://github.com/opnsense/src.git
synced 2026-02-19 02:30:08 -05:00
uma: Avoid excessive per-CPU draining
After commit389a3fa693, uma_reclaim_domain(UMA_RECLAIM_DRAIN_CPU) calls uma_zone_reclaim_domain(UMA_RECLAIM_DRAIN_CPU) twice on each zone in addition to globally draining per-CPU caches. This was unintended and is unnecessarily slow; in particular, draining per-CPU caches requires binding to each CPU. Stop draining per-CPU caches when visiting each zone, just do it once in pcpu_cache_drain_safe() to minimize the amount of expensive sched_bind() calls. Fixes:389a3fa693("uma: Add UMA_ZONE_UNMANAGED") MFC after: 1 week Sponsored by: Klara, Inc. Sponsored by: NetApp, Inc. Reviewed by: gallatin, kib Differential Revision: https://reviews.freebsd.org/D49349 (cherry picked from commit f506d5af50fccc37f5aa9fe090e9a0d5f05506c8)
This commit is contained in:
parent
a4251e93f8
commit
02324ae827
1 changed files with 7 additions and 0 deletions
|
|
@ -5296,6 +5296,13 @@ uma_reclaim_domain(int req, int domain)
|
|||
zone_foreach(uma_reclaim_domain_cb, &args);
|
||||
break;
|
||||
case UMA_RECLAIM_DRAIN_CPU:
|
||||
/*
|
||||
* Reclaim globally visible free items from all zones, then drain
|
||||
* per-CPU buckets, then reclaim items freed while draining.
|
||||
* This approach minimizes expensive context switching needed to
|
||||
* drain each zone's per-CPU buckets.
|
||||
*/
|
||||
args.req = UMA_RECLAIM_DRAIN;
|
||||
zone_foreach(uma_reclaim_domain_cb, &args);
|
||||
pcpu_cache_drain_safe(NULL);
|
||||
zone_foreach(uma_reclaim_domain_cb, &args);
|
||||
|
|
|
|||
Loading…
Reference in a new issue