Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 13 Nov 2015 15:52:45 -0800
From:      Adrian Chadd <adrian@freebsd.org>
To:        Gleb Smirnoff <glebius@freebsd.org>
Cc:        "src-committers@freebsd.org" <src-committers@freebsd.org>,  "svn-src-all@freebsd.org" <svn-src-all@freebsd.org>,  "svn-src-head@freebsd.org" <svn-src-head@freebsd.org>
Subject:   Re: svn commit: r290481 - head/sys/kern
Message-ID:  <CAJ-Vmo=5z7ZP1HPPX78GYg2NnwFZ8PJF3Z31b7B1CLYb40H-Gg@mail.gmail.com>
In-Reply-To: <20151113224431.GD73031@FreeBSD.org>
References:  <201511070404.tA7440RE080849@repo.freebsd.org> <20151113224431.GD73031@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Peter Holm already approached me to ask about it.

The problem has been figuring out how to trigger it in an automated / VM way. :(


-a


On 13 November 2015 at 14:44, Gleb Smirnoff <glebius@freebsd.org> wrote:
> On Sat, Nov 07, 2015 at 04:04:00AM +0000, Adrian Chadd wrote:
> A> Author: adrian
> A> Date: Sat Nov  7 04:04:00 2015
> A> New Revision: 290481
> A> URL: https://svnweb.freebsd.org/changeset/base/290481
> A>
> A> Log:
> A>   Add a sched_yield() to work around low memory conditions in the current code.
> A>
> A>   Things seem to get stuck in low memory conditions where no bufs are available,
> A>   the reclamation path is called to wakeup the daemon, but no sleeping is done.
> A>   Because of this, we are stuck in a tight loop in the current process and
> A>   never run said reclamation path.
> A>
> A>   This was introduced in r289279 . This is only a temporary workaround
> A>   to restore system usefulness until the more permanent solutions can be
> A>   found.
> A>
> A>   Tested:
> A>
> A>   * Carambola2, 64MB (and 32MB by manual config.)
> A>
> A> Modified:
> A>   head/sys/kern/vfs_bio.c
> A>
> A> Modified: head/sys/kern/vfs_bio.c
> A> ==============================================================================
> A> --- head/sys/kern/vfs_bio.c  Sat Nov  7 02:18:19 2015        (r290480)
> A> +++ head/sys/kern/vfs_bio.c  Sat Nov  7 04:04:00 2015        (r290481)
> A> @@ -3622,6 +3622,23 @@ loop:
> A>              if (bp == NULL) {
> A>                      if (slpflag || slptimeo)
> A>                              return NULL;
> A> +                    /*
> A> +                     * XXX This is here until the sleep path is diagnosed
> A> +                     * enough to work under very low memory conditions.
> A> +                     *
> A> +                     * There's an issue on low memory, 4BSD+non-preempt
> A> +                     * systems (eg MIPS routers with 32MB RAM) where buffer
> A> +                     * exhaustion occurs without sleeping for buffer
> A> +                     * reclaimation.  This just sticks in a loop and
> A> +                     * constantly attempts to allocate a buffer, which
> A> +                     * hits exhaustion and tries to wakeup bufdaemon.
> A> +                     * This never happens because we never yield.
> A> +                     *
> A> +                     * The real solution is to identify and fix these cases
> A> +                     * so we aren't effectively busy-waiting in a loop
> A> +                     * until the reclaimation path has cycles to run.
> A> +                     */
> A> +                    kern_yield(PRI_USER);
> A>                      goto loop;
> A>              }
>
> It'll be nice if such crutches have a test case in src/tests, and a
> reference to it in the comment above. So that in future, someone
> considering that the crutch is no longer needed, can quickly check that
> assumption.
>
> --
> Totus tuus, Glebius.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAJ-Vmo=5z7ZP1HPPX78GYg2NnwFZ8PJF3Z31b7B1CLYb40H-Gg>