diff options
author | David Rientjes <rientjes@google.com> | 2022-12-27 22:05:48 -0800 |
---|---|---|
committer | Vlastimil Babka <vbabka@suse.cz> | 2023-01-02 09:31:05 +0100 |
commit | cc2e9d2b26c86c1dd8687f6916e5f621bcacd6f7 (patch) | |
tree | 51af4df8df89ddb5322e276d1ec57648268893ef /mm | |
parent | 88603b6dc419445847923fcb7fe5080067a30f98 (diff) | |
download | linux-cc2e9d2b26c86c1dd8687f6916e5f621bcacd6f7.tar.bz2 |
mm, slab: periodically resched in drain_freelist()
drain_freelist() can be called with a very large number of slabs to free,
such as for kmem_cache_shrink(), or depending on various settings of the
slab cache when doing periodic reaping.
If there is a potentially long list of slabs to drain, periodically
schedule to ensure we aren't saturating the cpu for too long.
Signed-off-by: David Rientjes <rientjes@google.com>
Reviewed-by: Hyeonggon Yoo <42.hyeyoo@gmail.com>
Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
Diffstat (limited to 'mm')
-rw-r--r-- | mm/slab.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/mm/slab.c b/mm/slab.c index 7a269db050ee..29300fc1289a 100644 --- a/mm/slab.c +++ b/mm/slab.c @@ -2211,6 +2211,8 @@ static int drain_freelist(struct kmem_cache *cache, raw_spin_unlock_irq(&n->list_lock); slab_destroy(cache, slab); nr_freed++; + + cond_resched(); } out: return nr_freed; |