1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-19 10:53:58 +00:00

avoid LOR and gratuitous extra lock acquisitions by moving user_evict list buffers to

a temporary list
This commit is contained in:
Kip Macy 2009-05-07 21:51:13 +00:00
parent 77d0162c70
commit 6ef1a81d6e
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=191903

View File

@ -1712,14 +1712,23 @@ arc_adjust(void)
static void
arc_do_user_evicts(void)
{
static arc_buf_t *tmp_arc_eviction_list;
/*
* Move list over to avoid LOR
*/
restart:
mutex_enter(&arc_eviction_mtx);
while (arc_eviction_list != NULL) {
arc_buf_t *buf = arc_eviction_list;
arc_eviction_list = buf->b_next;
tmp_arc_eviction_list = arc_eviction_list;
arc_eviction_list = NULL;
mutex_exit(&arc_eviction_mtx);
while (tmp_arc_eviction_list != NULL) {
arc_buf_t *buf = tmp_arc_eviction_list;
tmp_arc_eviction_list = buf->b_next;
rw_enter(&buf->b_lock, RW_WRITER);
buf->b_hdr = NULL;
rw_exit(&buf->b_lock);
mutex_exit(&arc_eviction_mtx);
if (buf->b_efunc != NULL)
VERIFY(buf->b_efunc(buf) == 0);
@ -1727,9 +1736,10 @@ arc_do_user_evicts(void)
buf->b_efunc = NULL;
buf->b_private = NULL;
kmem_cache_free(buf_cache, buf);
mutex_enter(&arc_eviction_mtx);
}
mutex_exit(&arc_eviction_mtx);
if (arc_eviction_list != NULL)
goto restart;
}
/*