[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <d4e9359fdb3817bbc2b2c7cea368f8fd0dc7da62.camel@surriel.com>
Date: Mon, 28 Jan 2019 15:34:03 -0500
From: Rik van Riel <riel@...riel.com>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: linux-kernel@...r.kernel.org, linux-mm@...ck.org,
kernel-team@...com, Johannes Weiner <hannes@...xchg.org>,
Chris Mason <clm@...com>, Roman Gushchin <guro@...com>,
Michal Hocko <mhocko@...e.com>
Subject: Re: [PATCH] mm,slab,vmscan: accumulate gradual pressure on small
slabs
On Mon, 2019-01-28 at 12:10 -0800, Andrew Morton wrote:
> On Mon, 28 Jan 2019 15:03:28 -0500 Rik van Riel <riel@...riel.com>
> wrote:
>
> > On Mon, 2019-01-28 at 11:54 -0800, Andrew Morton wrote:
> > > On Mon, 28 Jan 2019 14:35:35 -0500 Rik van Riel <riel@...riel.com
> > > >
> > > wrote:
> > >
> > > > memory.
> > > > */
> > > > - delta = max_t(unsigned long long, delta, min(freeable,
> > > > batch_size));
> > > > + if (!delta) {
> > > > + shrinker->small_scan += freeable;
> > > > +
> > > > + delta = shrinker->small_scan >> priority;
> > > > + shrinker->small_scan -= delta << priority;
When delta is a non-zero number, we subtract (delta << priority)
from shrinker->small_scan.
That should happen every time delta >= (1<<priority), which is
4096 for DEF_PRIORITY.
> > > > +
> > > > + delta *= 4;
> > > > + do_div(delta, shrinker->seeks);
> > >
> > > What prevents shrinker->small_scan from over- or underflowing
> > > over
> > > time?
> >
> > We only go into this code path if
> > delta >> DEF_PRIORITY is zero.
> >
> > That is, freeable is smaller than 4096.
> >
>
> I'm still not understanding. If `freeable' always has a value of
> (say)
> 1, we'll eventually overflow shrinker->small_scan? Or at least, it's
> unobvious why this cannot happen.
--
All Rights Reversed.
Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)
Powered by blists - more mailing lists