Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 11 Sep 2018 11:08:49 -0400
From:      Mark Johnston <markj@freebsd.org>
To:        Robert <robert.ayrapetyan@gmail.com>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: Sudden grow of memory in "Laundry" state
Message-ID:  <20180911150849.GD92634@raichu>
In-Reply-To: <ce38cbfa-e1c5-776e-ef2e-2b867c9a520f@gmail.com>
References:  <55b0dd7d-19a3-b566-0602-762b783e8ff3@gmail.com> <20180911005411.GF2849@raichu> <ce38cbfa-e1c5-776e-ef2e-2b867c9a520f@gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Sep 10, 2018 at 10:18:31PM -0700, Robert wrote:
> Hi, if I understood correctly, "written back to swap device" means they 
> come from swap at some point, but it's not the case (see attached graph).

Sorry, I didn't mean to imply that.  Pages containing your application's
shared memory, for instance, would simply be written to the swap device
before being freed and reused for some other purpose.

Your graph shows a sudden drop in free memory.  Does that coincide with
the sudden increase in size of the laundry queue?

> Swap was 16GB, and slightly reduced when pages rapidly started to move 
> from free (or "Inactive"?) into "Laundry" queue.

Right.  Specifically, the amount of free swap space decreased right at
the time that the amount of free memory dropped, so what likely happened
is that the system wrote some pages in "Laundry" to the swap device so
that they could be freed, as a response to the drop in free memory.

> Here is vmstat output:
> 
> vmstat -s
> [...]
> 12 clean page reclamation shortfalls

This line basically means that at some point we were writing pages to
the swap device as fast as possible in order to reclaim some memory.

> What do you think? How pages could be moved into "Laundry" without being 
> in Swap?

That's perfectly normal.  Pages typically move from "Active" or
"Inactive" to laundry.

> 
> On 09/10/18 17:54, Mark Johnston wrote:
> > On Mon, Sep 10, 2018 at 11:44:52AM -0700, Robert wrote:
> >> Hi, I have a server with FreeBSD 11.2 and 48 Gigs of RAM where an app
> >> with extensive usage of shared memory (24GB allocation) is running.
> >>
> >> After some random amount of time (usually few days of running), there
> >> happens a sudden increase of "Laundry" memory grow (from zero to 24G in
> >> a few minutes).
> >>
> >> Then slowly it reduces.
> >>
> >> Are described symptoms normal and expected? I've never noticed anything
> >> like that on 11.1.
> > The laundry queue contains dirty inactive pages, which need to be
> > written back to the swap device or a filesystem before they can be
> > reused.  When the system is short for free pages, it will scan the
> > inactive queue looking for clean pages, which can be freed cheaply.
> > Dirty pages are moved to the laundry queue.  My guess is that the
> > system was running without a page shortage for a long time, and
> > suddenly experienced some memory pressure.  This caused lots of
> > pages to move from the inactive queue to the laundry queue.  Demand
> > for free pages will then cause pages in the laundry queue to be
> > written back and freed, or requeued if the page was referenced after
> > being placed in the laundry queue.  "vmstat -s" and "sysctl vm.stats"
> > output might make things more clear.
> >
> > All this is to say that there's nothing particularly abnormal about what
> > you're observing, though it's not clear what effects this behaviour has
> > on your workload, if any.  I can't think of any direct reason this would
> > happen on 11.2 but not 11.1.
> 





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