linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Nick Piggin <nickpiggin@yahoo.com.au>
To: "Chen, Kenneth W" <kenneth.w.chen@intel.com>
Cc: Benjamin LaHaise <bcrl@linux.intel.com>,
	Andrew Morton <akpm@osdl.org>,
	linux-mm@kvack.org, netdev@vger.kernel.org
Subject: Re: [PATCH] avoid atomic op on page free
Date: Tue, 07 Mar 2006 15:13:23 +1100	[thread overview]
Message-ID: <440D0863.8070304@yahoo.com.au> (raw)
In-Reply-To: <200603070230.k272UVg18638@unix-os.sc.intel.com>

Chen, Kenneth W wrote:
> Nick Piggin wrote on Monday, March 06, 2006 6:05 PM
> 
>>My patches in -mm avoid the lru_lock and disabling/enabling interrupts
>>if the page is not on lru too, btw.
> 
> 
> Can you put the spin lock/unlock inside TestClearPageLRU()?  The
> difference is subtle though.
> 

That's the idea, but you just need to do a little bit more so as not to
introduce a race.

http://www.kernel.org/pub/linux/kernel/people/akpm/patches/2.6/2.6.16-rc2/2.6.16-rc2-mm1/broken-out/mm-never-clearpagelru-released-pages.patch

> - Ken
> 
> 
> --- ./mm/swap.c.orig	2006-03-06 19:25:10.680967542 -0800
> +++ ./mm/swap.c	2006-03-06 19:27:02.334286487 -0800
> @@ -210,14 +210,16 @@ int lru_add_drain_all(void)
>  void fastcall __page_cache_release(struct page *page)
>  {
>  	unsigned long flags;
> -	struct zone *zone = page_zone(page);
> +	struct zone *zone;
>  
> -	spin_lock_irqsave(&zone->lru_lock, flags);
> -	if (TestClearPageLRU(page))
> +	if (TestClearPageLRU(page)) {
> +		zone = page_zone(page);
> +		spin_lock_irqsave(&zone->lru_lock, flags);
>  		del_page_from_lru(zone, page);
> -	if (page_count(page) != 0)
> -		page = NULL;
> -	spin_unlock_irqrestore(&zone->lru_lock, flags);
> +		if (page_count(page) != 0)
> +			page = NULL;
> +		spin_unlock_irqrestore(&zone->lru_lock, flags);
> +	}
>  	if (page)
>  		free_hot_page(page);
>  }
> 
> 


-- 
SUSE Labs, Novell Inc.
Send instant messages to your online friends http://au.messenger.yahoo.com 

--
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:[~2006-03-07  4:13 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-07  0:10 Benjamin LaHaise
2006-03-07  0:50 ` Andrew Morton
2006-03-07  1:11   ` Benjamin LaHaise
2006-03-07  1:39     ` Andrew Morton
2006-03-07  1:52       ` Benjamin LaHaise
2006-03-07  6:30         ` Andi Kleen
2006-03-07  2:04     ` Nick Piggin
2006-03-07  2:10       ` Benjamin LaHaise
2006-03-07  4:08         ` Nick Piggin
2006-03-07  2:30       ` Chen, Kenneth W
2006-03-07  4:13         ` Nick Piggin [this message]
2006-03-07  1:21   ` Rick Jones
2006-03-07  1:53 ` Nick Piggin
2006-03-07  1:58   ` Benjamin LaHaise
2006-03-07  2:14     ` Nick Piggin

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=440D0863.8070304@yahoo.com.au \
    --to=nickpiggin@yahoo.com.au \
    --cc=akpm@osdl.org \
    --cc=bcrl@linux.intel.com \
    --cc=kenneth.w.chen@intel.com \
    --cc=linux-mm@kvack.org \
    --cc=netdev@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox