linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Rik van Riel <riel@surriel.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	kernel-team@fb.com,  Johannes Weiner <hannes@cmpxchg.org>,
	Chris Mason <clm@fb.com>, Roman Gushchin <guro@fb.com>,
	Michal Hocko <mhocko@suse.com>
Subject: Re: [PATCH] mm,slab,vmscan: accumulate gradual pressure on small slabs
Date: Mon, 28 Jan 2019 15:34:03 -0500	[thread overview]
Message-ID: <d4e9359fdb3817bbc2b2c7cea368f8fd0dc7da62.camel@surriel.com> (raw)
In-Reply-To: <20190128121028.8ef4c19dd3fd1d60d2e3284c@linux-foundation.org>

[-- Attachment #1: Type: text/plain, Size: 1344 bytes --]

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@surriel.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@surriel.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.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2019-01-28 20:34 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-28 19:35 Rik van Riel
2019-01-28 19:45 ` Roman Gushchin
2019-01-28 19:54 ` Andrew Morton
2019-01-28 20:03   ` Rik van Riel
2019-01-28 20:10     ` Andrew Morton
2019-01-28 20:34       ` Rik van Riel [this message]
2019-01-28 21:31 ` Johannes Weiner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d4e9359fdb3817bbc2b2c7cea368f8fd0dc7da62.camel@surriel.com \
    --to=riel@surriel.com \
    --cc=akpm@linux-foundation.org \
    --cc=clm@fb.com \
    --cc=guro@fb.com \
    --cc=hannes@cmpxchg.org \
    --cc=kernel-team@fb.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox