lkml.org 
[lkml]   [2023]   [Mar]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v5 7/8] mm: vmscan: remove shrinker_rwsem from synchronize_shrinkers()
Date
Currently, the synchronize_shrinkers() is only used by TTM
pool. It only requires that no shrinkers run in parallel,
and doesn't care about registering and unregistering of
shrinkers.

Since slab shrink is protected by SRCU, synchronize_srcu()
is sufficient to ensure that no shrinker is running in
parallel. So the shrinker_rwsem in synchronize_shrinkers()
is no longer needed, just remove it.

Signed-off-by: Qi Zheng <zhengqi.arch@bytedance.com>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
Acked-by: Kirill Tkhai <tkhai@ya.ru>
---
mm/vmscan.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/mm/vmscan.c b/mm/vmscan.c
index 8c1ae7ea8dea..2b22a42d83c4 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -790,15 +790,11 @@ EXPORT_SYMBOL(unregister_shrinker);
/**
* synchronize_shrinkers - Wait for all running shrinkers to complete.
*
- * This is equivalent to calling unregister_shrink() and register_shrinker(),
- * but atomically and with less overhead. This is useful to guarantee that all
- * shrinker invocations have seen an update, before freeing memory, similar to
- * rcu.
+ * This is useful to guarantee that all shrinker invocations have seen an
+ * update, before freeing memory.
*/
void synchronize_shrinkers(void)
{
- down_write(&shrinker_rwsem);
- up_write(&shrinker_rwsem);
atomic_inc(&shrinker_srcu_generation);
synchronize_srcu(&shrinker_srcu);
}
--
2.20.1
\
 
 \ /
  Last update: 2023-03-27 00:56    [W:0.161 / U:0.036 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site