public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrea Arcangeli <andrea@suse.de>
To: Andrew Morton <akpm@osdl.org>
Cc: linux-kernel@vger.kernel.org, edwardsg@sgi.com
Subject: Re: shrinker->nr = LONG_MAX means deadlock for icache
Date: Sat, 19 Nov 2005 12:38:34 +0100	[thread overview]
Message-ID: <20051119113834.GB18782@opteron.random> (raw)
In-Reply-To: <20051119030306.3049837d.akpm@osdl.org>

On Sat, Nov 19, 2005 at 03:03:06AM -0800, Andrew Morton wrote:
> It would be nice to understand exactly what's gone wrong.

I found something more, see below.

> I guess so, although I worry that this way we'll obscure the real bug,
> whatever it is.

Now that I understand better the math around scanned and lru_pages I
believe their caller could be the reason they have this huge number in
"nr" is because they pass 0 to shrink all slabs entries. As said in the
previous email they lockup when invoking the slab shrinking with the
toss-cache feature.  They should have passed "tossed" as third parameter
too, not 0.

			int tossed = atomic_read(&npgs_tossed);
			shrink_slab(tossed, GFP_KERNEL, 0 /* shrink max */);
			atomic_set(&npgs_tossed, 0);

The zero as thrid parameter means nr will be "max_pass * scanned", so if
both the page-lru is huge and the icache is huge, that can lead to an
huge value.

They should also add a WARN_ON to be sure that "tossed" is never
negative just in case: when the "tossed" gets sign zero extended during
the int2unsigned-long conversion, that could generate the huge number if
tossed was negative.

So the caller has to be fixed too, even if now it would be ok to pass 0
without risking huge nr values (after fixing the unrelated __GFP_IO bug).

So hopefully the "0" as third parameter is good enough to explain the
(other) real bug and we won't be hiding more bugs with this fix.

> Sure.  You've limited the number of scanned objects in one pass to twice
> the number of objects - there's no point in doing more work than that.

Agreed.

> A return value of 3 is very odd.  I'd be suspecting a mismeasurement. 
> Unless someone had altered vfs_cache_pressure.

Exactly.

> OK.  Well If Edward&co could do a bit more investigation it'd be great -
> meanwhile I'll hang onto this (and might add some mm-only debugging,
> depending on how Edward gets on):

Looks good to me, thanks!

  reply	other threads:[~2005-11-19 11:38 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-18 17:12 shrinker->nr = LONG_MAX means deadlock for icache Andrea Arcangeli
2005-11-19  7:29 ` Andrew Morton
2005-11-19 10:37   ` Andrea Arcangeli
2005-11-19 11:03     ` Andrew Morton
2005-11-19 11:38       ` Andrea Arcangeli [this message]
2005-11-22 23:01         ` Greg Edwards

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=20051119113834.GB18782@opteron.random \
    --to=andrea@suse.de \
    --cc=akpm@osdl.org \
    --cc=edwardsg@sgi.com \
    --cc=linux-kernel@vger.kernel.org \
    /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