LKML Archive on lore.kernel.org help / color / mirror / Atom feed
From: Andy Whitcroft <apw@shadowen.org> To: Christoph Lameter <clameter@engr.sgi.com> Cc: Andrew Morton <akpm@osdl.org>, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Mel Gorman <mel@csn.ul.ie> Subject: Re: [PATCH 1/5] Lumpy Reclaim V3 Date: Fri, 02 Mar 2007 15:45:51 +0000 [thread overview] Message-ID: <45E846AF.1050703@shadowen.org> (raw) In-Reply-To: <Pine.LNX.4.64.0702281008330.21257@schroedinger.engr.sgi.com> Christoph Lameter wrote: > On Tue, 27 Feb 2007, Andy Whitcroft wrote: > >> +static int __isolate_lru_page(struct page *page, int active) >> +{ >> + int ret = -EINVAL; >> + >> + if (PageLRU(page) && (PageActive(page) == active)) { >> + ret = -EBUSY; >> + if (likely(get_page_unless_zero(page))) { >> + /* >> + * Be careful not to clear PageLRU until after we're >> + * sure the page is not being freed elsewhere -- the >> + * page release code relies on it. >> + */ >> + ClearPageLRU(page); >> + ret = 0; > > Is that really necessary? PageLRU is clear when a page is freed right? > And clearing PageLRU requires the zone->lru_lock since we have to move it > off the LRU. Although the PageLRU is stable as we have the zone->lru_lock we cannot take the page off the LRU unless we can take a reference to it preventing it from being released. The page release code relies on the the caller who takes the reference count to zero having exclusive access to the page to release it. To prevent a race with put_page/__page_cache_release we cannot touch the page once its count drops to zero, which occurs before the PageLRU is cleared. PageLRU being sampled outside the zone->lru_lock in that path to avoid taking the lock if not required. > >> - ClearPageLRU(page); >> - target = dst; >> + active = PageActive(page); > > Why are we saving the active state? Page cannot be moved between LRUs > while we hold the lru lock anyways. This is used later in the function for comparison against all of the other pages in the 'order' sized area rooted about the target page. Its mearly an optimisation. -apw
next prev parent reply other threads:[~2007-03-02 15:46 UTC|newest] Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top 2007-02-27 19:33 [PATCH 0/5] Lumpy Reclaim V4 Andy Whitcroft 2007-02-27 19:34 ` [PATCH 1/5] Lumpy Reclaim V3 Andy Whitcroft 2007-02-28 18:14 ` Christoph Lameter 2007-03-02 15:45 ` Andy Whitcroft [this message] 2007-02-27 19:34 ` [PATCH 2/5] lumpy: isolate_lru_pages wants to specifically take active or inactive pages Andy Whitcroft 2007-02-28 18:17 ` Christoph Lameter 2007-03-02 15:57 ` Andy Whitcroft 2007-02-27 19:35 ` [PATCH 3/5] lumpy: ensure that we compare PageActive and active safely Andy Whitcroft 2007-02-27 19:35 ` [PATCH 4/5] lumpy: update commentry on subtle comparisons and rounding assumptions Andy Whitcroft 2007-02-27 19:36 ` [PATCH 5/5] lumpy: only check for valid pages when holes are present Andy Whitcroft
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=45E846AF.1050703@shadowen.org \ --to=apw@shadowen.org \ --cc=akpm@osdl.org \ --cc=clameter@engr.sgi.com \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-mm@kvack.org \ --cc=mel@csn.ul.ie \ /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: linkBe 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; as well as URLs for NNTP newsgroup(s).