public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg Edwards <edwardsg@sgi.com>
To: Andrea Arcangeli <andrea@suse.de>
Cc: Andrew Morton <akpm@osdl.org>,
	linux-kernel@vger.kernel.org, dgc@sgi.com,
	Jack Steiner <steiner@sgi.com>, Robin Holt <holt@sgi.com>,
	Paul Jackson <pj@sgi.com>
Subject: Re: shrinker->nr = LONG_MAX means deadlock for icache
Date: Tue, 22 Nov 2005 17:01:40 -0600	[thread overview]
Message-ID: <20051122230140.GA5058@sgi.com> (raw)
In-Reply-To: <20051119113834.GB18782@opteron.random>

On Sat, Nov 19, 2005 at 12:38:34PM +0100, Andrea Arcangeli wrote:
| 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.

Looks like Andrea found the real culprit.


| > 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!

CC'ed some of the folks who debugged this, in case they have anything to
add.

Greg

      reply	other threads:[~2005-11-22 23:02 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
2005-11-22 23:01         ` Greg Edwards [this message]

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=20051122230140.GA5058@sgi.com \
    --to=edwardsg@sgi.com \
    --cc=akpm@osdl.org \
    --cc=andrea@suse.de \
    --cc=dgc@sgi.com \
    --cc=holt@sgi.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pj@sgi.com \
    --cc=steiner@sgi.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