[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20111230112723.GD15729@suse.de>
Date: Fri, 30 Dec 2011 11:27:23 +0000
From: Mel Gorman <mgorman@...e.de>
To: Rik van Riel <riel@...hat.com>
Cc: Hugh Dickins <hughd@...gle.com>, Minchan Kim <minchan@...nel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Andrea Arcangeli <aarcange@...hat.com>,
Minchan Kim <minchan.kim@...il.com>,
Dave Jones <davej@...hat.com>, Jan Kara <jack@...e.cz>,
Andy Isaacson <adi@...apodia.org>,
Johannes Weiner <jweiner@...hat.com>,
Nai Xia <nai.xia@...il.com>, Linux-MM <linux-mm@...ck.org>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 11/11] mm: Isolate pages for immediate reclaim on their
own LRU
On Thu, Dec 29, 2011 at 02:31:20PM -0500, Rik van Riel wrote:
> On 12/29/2011 11:59 AM, Mel Gorman wrote:
>
> >I considered a few ways of fixing this. The obvious one is to add a
> >new page flag but that is difficult to justify as the high-cpu-usage
> >problem should only occur when there is a lot of writeback to slow
> >storage which I believe is a rare case. It is not a suitable use for
> >an extended page flag.
>
> Actually, don't we already have three LRU related
> bits in the page flags?
>
Yes - PG_active, PG_unevictable and PG_swapbacked
> We could stop using those as bit flags, and use
> them as a number instead. That way we could encode
> up to 7 or 8 (depending on how we use all-zeroes)
> LRU lists with the number of bits we have now.
>
I wondered about this and I felt there were two problems.
One was reading and updating them atomically. To do this safely,
the page would either need to be locked, have the page isolated from
the LRU without any other references or be protected by the zone->lru
lock. For the most part we are accessing these bits under the page lock
and in cases such as rotate_reclaimable_page()[1] or truncation that do
not necessarily hold the page lock, we would depend on the zone->lru to
prevent parallel changes (particularly updating PageActive). I did not
spot a case where we were not protected by some combination of the page
lock and zone->lru so it should be fine but there might be a corner
case I missed. Can you think of one? If a case is missed, it means
that it is possible to get an invalid LRU index leading to corruption.
The other problem is that certain operations become more expensive. We
can no longer check one bit for PageActive for example. We'd have
to read the LRU index and see if it corresponds to an activated
page or not. This is not insurmountable but there would be a small
hit for any path that currently checks PageSwapBacked, PageActive
or PageUnevictable.
[1] I noticed another bug in the LRU immediate patch. It's possible
to call pagevec_putback_from_immediate on a page isolated for reclaim
because the check for PageLRU is wrong.
--
Mel Gorman
SUSE Labs
--
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