All of lore.kernel.org
 help / color / mirror / Atom feed
From: mark gross <mgross@linux.intel.com>
To: Minchan Kim <minchan.kim@gmail.com>
Cc: linux-mm@kvack.org, Nick Piggin <npiggin@suse.de>,
	Christoph Lameter <cl@linux-foundation.org>
Subject: Re: possible bug in find_get_pages
Date: Mon, 9 Mar 2009 09:43:16 -0700	[thread overview]
Message-ID: <20090309164316.GB31140@linux.intel.com> (raw)
In-Reply-To: <20090307084732.b01bcfee.minchan.kim@barrios-desktop>

On Sat, Mar 07, 2009 at 08:47:32AM +0900, Minchan Kim wrote:
> Nick already found and solved this problem .
> It can help you. 
> 
> http://patchwork.kernel.org/patch/860/
> 

Wow, this reads just like the problem we are seeing.  I'll try the
patch and let the test run for a few days!

We've even see it come out of the live lock once in a while as well.  I
was thinking cache coherency HW issue until this :)

I'll send an update after running the test.

thanks!

--mgross


> 
> > On Fri, 6 Mar 2009 11:26:25 -0800
> > mark gross <mgross@linux.intel.com> wrote:
> >
> > I'm looking at a system hang (note: new hardware going under stress
> > tests using a ubuntu 2.6.27-11-generic)
> > 
> > It seems that page->_count == 0 at some point on some overnight runs
> > with locks the system into a tight loop from the repeat: and a goto
> > repeat in find_get_pages. 
> > 
> > Code inserted for convenience:
> > 
> > unsigned find_get_pages(struct address_space *mapping, pgoff_t start,
> > 			    unsigned int nr_pages, struct page **pages)
> > {
> > 	unsigned int i;
> > 	unsigned int ret;
> > 	unsigned int nr_found;
> > 
> > 	rcu_read_lock();
> > restart:
> > 	nr_found = radix_tree_gang_lookup_slot(&mapping->page_tree,
> > 				(void ***)pages, start, nr_pages);
> > 	ret = 0;
> > 	for (i = 0; i < nr_found; i++) {
> > 		struct page *page;
> > repeat:
> > 		page = radix_tree_deref_slot((void **)pages[i]);
> > 		if (unlikely(!page))
> > 			continue;
> > 		/*
> > 		 * this can only trigger if nr_found == 1, making
> > 		 * livelock
> > 		 * a non issue.
> > 		 */
> > 		if (unlikely(page == RADIX_TREE_RETRY))
> > 			goto restart;
> > 
> > 		if (!page_cache_get_speculative(page))
> > 			goto repeat; <---------_always_hits_ 
> > 
> > 		/* Has the page moved? */
> > 		if (unlikely(page != *((void **)pages[i]))) {
> > 			page_cache_release(page);
> > 			goto repeat;
> > 		}
> > 
> > 		pages[ret] = page;
> > 		ret++;
> > 	}
> > 	rcu_read_unlock();
> > 	return ret;
> > }
> > 
> > My question is that as I look at this code I don't see any way out of it
> > once I get a page with zero _count from radix_tree_deref_slot, then I
> > will get the same page forever.  The input to radix_tree_deref_slot
> > never changes so I assume the output should be the same crappy page with
> > zero _count that drops me on the goto repeat line.
> > 
> > Is this a bug?
> > 
> > Also, is having a page->_count == 0 an unexpected or invalid state?
> > 
> > Thanks!
> > 
> > --mgross
> > 
> > 
> > 
> > 
> > 
> > --
> > To unsubscribe, send a message with 'unsubscribe linux-mm' in
> > the body to majordomo@kvack.org.  For more info on Linux MM,
> > see: http://www.linux-mm.org/ .
> > Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
> 
> 
> -- 
> Kinds Regards
> Minchan Kim

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2009-03-09 16:39 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-06 19:26 possible bug in find_get_pages mark gross
2009-03-06 19:28 ` Christoph Lameter
2009-03-06 21:13   ` mark gross
2009-03-06 21:29     ` Christoph Lameter
2009-03-10 10:49   ` Nick Piggin
2009-03-06 23:47 ` Minchan Kim
2009-03-09 16:43   ` mark gross [this message]
2009-03-10 10:45     ` Nick Piggin
2009-03-10 22:49       ` mark gross

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=20090309164316.GB31140@linux.intel.com \
    --to=mgross@linux.intel.com \
    --cc=cl@linux-foundation.org \
    --cc=linux-mm@kvack.org \
    --cc=minchan.kim@gmail.com \
    --cc=npiggin@suse.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.