[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Wed, 5 May 2010 11:02:25 -0700 (PDT)
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Mel Gorman <mel@....ul.ie>
cc: Andrew Morton <akpm@...ux-foundation.org>,
Linux-MM <linux-mm@...ck.org>,
LKML <linux-kernel@...r.kernel.org>,
Minchan Kim <minchan.kim@...il.com>,
KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>,
Christoph Lameter <cl@...ux.com>,
Andrea Arcangeli <aarcange@...hat.com>,
Rik van Riel <riel@...hat.com>
Subject: Re: [PATCH 1/2] mm,migration: Prevent rmap_walk_[anon|ksm] seeing
the wrong VMA information
On Wed, 5 May 2010, Mel Gorman wrote:
>
> If the same_vma list is properly ordered then maybe something like the
> following is allowed?
Heh. This is the same logic I just sent out. However:
> + anon_vma = page_rmapping(page);
> + if (!anon_vma)
> + return NULL;
> +
> + spin_lock(&anon_vma->lock);
RCU should guarantee that this spin_lock() is valid, but:
> + /*
> + * Get the oldest anon_vma on the list by depending on the ordering
> + * of the same_vma list setup by __page_set_anon_rmap
> + */
> + avc = list_entry(&anon_vma->head, struct anon_vma_chain, same_anon_vma);
We're not guaranteed that the 'anon_vma->head' list is non-empty.
Somebody could have freed the list and the anon_vma and we have a stale
'page->anon_vma' (that has just not been _released_ yet).
And shouldn't that be 'list_first_entry'? Or &anon_vma->head.next?
How did that line actually work for you? Or was it just a "it boots", but
no actual testing of the rmap walk?
Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists