Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 5 Oct 2012 19:02:24 +0300
From:      Nikolay Denev <ndenev@gmail.com>
To:        Andriy Gapon <avg@freebsd.org>
Cc:        freebsd-fs <freebsd-fs@freebsd.org>
Subject:   Re: nfs + zfs hangs on RELENG_9
Message-ID:  <7423226525986478629@unknownmsgid>
In-Reply-To: <506ED16C.7000207@FreeBSD.org>
References:  <906543F2-96BD-4519-B693-FD5AFB646F87@gmail.com> <506BF372.1090208@FreeBSD.org> <CF9C7048-15C1-4C7A-8395-2BAB3AE31322@gmail.com> <506C4049.4040100@FreeBSD.org> <D50A4777-BF2E-438A-B15B-661D4CB3C3B6@gmail.com> <506D81A7.8030506@FreeBSD.org> <506DB5DB.7080302@FreeBSD.org> <506ED16C.7000207@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Applied and running. Will report if there are issues.

Sent from my iPhone

On 05.10.2012, at 15:24, Andriy Gapon <avg@freebsd.org> 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



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