Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 17 Feb 2017 15:00:13 +0000 (UTC)
From:      Josh Paetzel <jpaetzel@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org
Subject:   svn commit: r313876 - vendor-sys/illumos/dist/uts/common/fs/zfs
Message-ID:  <201702171500.v1HF0Dag058871@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jpaetzel
Date: Fri Feb 17 15:00:13 2017
New Revision: 313876
URL: https://svnweb.freebsd.org/changeset/base/313876

Log:
  7504 kmem_reap hangs spa_sync and administrative tasks
  
  illumos/illumos-gate@405a5a0f5c3ab36cb76559467d1a62ba648bd809
  https://github.com/illumos/illumos-gate/commit/405a5a0f5c3ab36cb76559467d1a62ba648bd80
  
  https://www.illumos.org/issues/7504
  
    We see long spa_sync(). We are waiting to hold dp_config_rwlock for writer. Some
    other thread holds dp_config_rwlock for reader, then calls arc_get_data_buf(),
    which finds that arc_is_overflowing()==B_TRUE. So it waits (while holding
    dp_config_rwlock for reader) for arc_reclaim_thread to signal arc_reclaim_waiters_cv.
    Before signaling, arc_reclaim_thread does arc_kmem_reap_now(), which takes ~seconds.
  
  Author: Matthew Ahrens <mahrens@delphix.com>
  Reviewed by: George Wilson <george.wilson@delphix.com>
  Reviewed by: Prakash Surya <prakash.surya@delphix.com>
  Approved by: Dan McDonald <danmcd@omniti.com>

Modified:
  vendor-sys/illumos/dist/uts/common/fs/zfs/arc.c

Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/arc.c
==============================================================================
--- vendor-sys/illumos/dist/uts/common/fs/zfs/arc.c	Fri Feb 17 14:55:59 2017	(r313875)
+++ vendor-sys/illumos/dist/uts/common/fs/zfs/arc.c	Fri Feb 17 15:00:13 2017	(r313876)
@@ -3748,7 +3748,6 @@ arc_reclaim_thread(void)
 
 	mutex_enter(&arc_reclaim_lock);
 	while (!arc_reclaim_thread_exit) {
-		int64_t free_memory = arc_available_memory();
 		uint64_t evicted = 0;
 
 		/*
@@ -3767,6 +3766,14 @@ arc_reclaim_thread(void)
 
 		mutex_exit(&arc_reclaim_lock);
 
+		/*
+		 * We call arc_adjust() before (possibly) calling
+		 * arc_kmem_reap_now(), so that we can wake up
+		 * arc_get_data_buf() sooner.
+		 */
+		evicted = arc_adjust();
+
+		int64_t free_memory = arc_available_memory();
 		if (free_memory < 0) {
 
 			arc_no_grow = B_TRUE;
@@ -3800,8 +3807,6 @@ arc_reclaim_thread(void)
 			arc_no_grow = B_FALSE;
 		}
 
-		evicted = arc_adjust();
-
 		mutex_enter(&arc_reclaim_lock);
 
 		/*



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201702171500.v1HF0Dag058871>