From owner-freebsd-fs@FreeBSD.ORG Fri Oct 5 16:02:30 2012 Return-Path: Delivered-To: freebsd-fs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 92DCE1065672; Fri, 5 Oct 2012 16:02:30 +0000 (UTC) (envelope-from ndenev@gmail.com) Received: from mail-vb0-f54.google.com (mail-vb0-f54.google.com [209.85.212.54]) by mx1.freebsd.org (Postfix) with ESMTP id 1AA148FC0A; Fri, 5 Oct 2012 16:02:28 +0000 (UTC) Received: by mail-vb0-f54.google.com with SMTP id v11so2635336vbm.13 for ; Fri, 05 Oct 2012 09:02:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=references:in-reply-to:mime-version:from:date:message-id:subject:to :cc:content-type; bh=D8ylqgSieQB4zVIYRx4Gk4fBmxvBVDxzcgfue3L+PWY=; b=iliS7tlgekd8tRqmUCf2lBiysgLc6PHLLd4T5surKYWzm8CSmGby6yMqvp+FTHBtp8 ozASn1kHXS3bd2HFj44/PJ+GgfBgtYxYcOu8PvAa9ziddjQnoffg9FiJqsqo2COXkZyB yE2a7dFHn/zx43YT3BiSNrH7hHAeo2ay5FT8upQ/uOl2EsAu3D+/4AzCgx+2mzGTQgHe gxyDmYLIUGll1dNSDMyYZrRPcs6LRNqBX4yb2LjXg5EinnEn3LdhpdI4Y4dRBXXFj8B0 vmO3D/ZgotmOtki2Qzt+P43J9ECUhkrya2hoV6LmX7xrqWjWOVvusoUgpiVvQ/gQpGXy qpRA== Received: by 10.58.144.232 with SMTP id sp8mr5624182veb.56.1349452947242; Fri, 05 Oct 2012 09:02:27 -0700 (PDT) References: <906543F2-96BD-4519-B693-FD5AFB646F87@gmail.com> <506BF372.1090208@FreeBSD.org> <506C4049.4040100@FreeBSD.org> <506D81A7.8030506@FreeBSD.org> <506DB5DB.7080302@FreeBSD.org> <506ED16C.7000207@FreeBSD.org> In-Reply-To: <506ED16C.7000207@FreeBSD.org> Mime-Version: 1.0 (1.0) From: Nikolay Denev Date: Fri, 5 Oct 2012 19:02:24 +0300 Message-ID: <7423226525986478629@unknownmsgid> To: Andriy Gapon Content-Type: text/plain; charset=ISO-8859-1 Cc: freebsd-fs Subject: Re: nfs + zfs hangs on RELENG_9 X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Oct 2012 16:02:30 -0000 Applied and running. Will report if there are issues. Sent from my iPhone On 05.10.2012, at 15:24, Andriy Gapon wrote: > on 04/10/2012 19:14 Andriy Gapon said the following: >> BTW, one thing to note here is that the lowmem hook was invoked because of KVA >> space shortage, not because of page shortage. >> >> From practical point of view this may mean that having sufficient KVA size may >> help to not run into this deadlock. >> >> From programming point of view I am tempted to let arc_lowmem block only if >> curproc == pageproc. That should both handle the case where blocking is most >> needed and should prevent the deadlock described above. > > A possible patch: > > --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c > +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c > @@ -3720,8 +3720,16 @@ arc_lowmem(void *arg __unused, int howto __unused) > mutex_enter(&arc_reclaim_thr_lock); > needfree = 1; > cv_signal(&arc_reclaim_thr_cv); > - while (needfree) > - msleep(&needfree, &arc_reclaim_thr_lock, 0, "zfs:lowmem", 0); > + > + /* > + * It is unsafe to block here in arbitrary threads, because we can come > + * here from ARC itself and may hold ARC locks and thus risk a deadlock > + * with ARC reclaim thread. > + */ > + if (curproc == pageproc) { > + while (needfree) > + msleep(&needfree, &arc_reclaim_thr_lock, 0, "zfs:lowmem", 0); > + } > mutex_exit(&arc_reclaim_thr_lock); > mutex_exit(&arc_lowmem_lock); > } > > -- > Andriy Gapon