[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <BANLkTimzg184ZWraBomJ8ex1-B4Ypj6D9Q@mail.gmail.com>
Date: Sun, 24 Apr 2011 12:02:57 +0900
From: KOSAKI Motohiro <kosaki.motohiro@...fujitsu.com>
To: Minchan Kim <minchan.kim@...il.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
linux-mm <linux-mm@...ck.org>,
LKML <linux-kernel@...r.kernel.org>,
Rik van Riel <riel@...hat.com>,
Hugh Dickins <hughd@...gle.com>,
Johannes Weiner <hannes@...xchg.org>,
Lee Schermerhorn <lee.schermerhorn@...com>
Subject: Re: [PATCH] Check PageActive when evictable page and unevicetable
page race happen
2011/4/24 Minchan Kim <minchan.kim@...il.com>:
> In putback_lru_page, unevictable page can be changed into evictable
> 's one while we move it among lru. So we have checked it again and
> rescued it. But we don't check PageActive, again. It could add
> active page into inactive list so we can see the BUG in isolate_lru_pages.
> (But I didn't see any report because I think it's very subtle)
>
> It could happen in race that zap_pte_range's mark_page_accessed and
> putback_lru_page. It's subtle but could be possible.
>
> Note:
> While I review the code, I found it. So it's not real report.
>
> Cc: Rik van Riel <riel@...hat.com>
> Cc: KOSAKI Motohiro <kosaki.motohiro@...fujitsu.com>
> Cc: Hugh Dickins <hughd@...gle.com>
> Cc: Johannes Weiner <hannes@...xchg.org>
> Cc: Lee Schermerhorn <lee.schermerhorn@...com>
> Signed-off-by: Minchan Kim <minchan.kim@...il.com>
> ---
> mm/vmscan.c | 4 +++-
> 1 files changed, 3 insertions(+), 1 deletions(-)
>
> diff --git a/mm/vmscan.c b/mm/vmscan.c
> index b3a569f..c0cd1aa 100644
> --- a/mm/vmscan.c
> +++ b/mm/vmscan.c
> @@ -562,7 +562,7 @@ int remove_mapping(struct address_space *mapping, struct page *page)
> void putback_lru_page(struct page *page)
> {
> int lru;
> - int active = !!TestClearPageActive(page);
> + int active;
> int was_unevictable = PageUnevictable(page);
>
> VM_BUG_ON(PageLRU(page));
> @@ -571,6 +571,7 @@ redo:
> ClearPageUnevictable(page);
>
> if (page_evictable(page, NULL)) {
> + active = !!TestClearPageActive(page);
> /*
> * For evictable pages, we can use the cache.
> * In event of a race, worst case is we end up with an
> @@ -584,6 +585,7 @@ redo:
> * Put unevictable pages directly on zone's unevictable
> * list.
> */
> + ClearPageActive(page);
> lru = LRU_UNEVICTABLE;
> add_page_to_unevictable_list(page);
I think we forgot 'goto redo' case. following patch is better?
------------------------------------------------
if (page_evictable(page, NULL)) {
/*
* For evictable pages, we can use the cache.
* In event of a race, worst case is we end up with an
* unevictable page on [in]active list.
* We know how to handle that.
*/
lru = active + page_lru_base_type(page);
+ if (active)
+ SetPageActive(page);
lru_cache_add_lru(page, lru);
--
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