From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from psmtp.com (na3sys010amx151.postini.com [74.125.245.151]) by kanga.kvack.org (Postfix) with SMTP id 29F8D6B005D for ; Tue, 21 Aug 2012 11:40:52 -0400 (EDT) Date: Tue, 21 Aug 2012 18:41:42 +0300 From: "Michael S. Tsirkin" Subject: Re: [PATCH v8 1/5] mm: introduce a common interface for balloon pages mobility Message-ID: <20120821154142.GA8268@redhat.com> References: <20120821135223.GA7117@redhat.com> <1345562166.23018.109.camel@twins> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1345562166.23018.109.camel@twins> Sender: owner-linux-mm@kvack.org List-ID: To: Peter Zijlstra Cc: Rafael Aquini , linux-mm@kvack.org, linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org, Rusty Russell , Rik van Riel , Mel Gorman , Andi Kleen , Andrew Morton , Konrad Rzeszutek Wilk , Minchan Kim On Tue, Aug 21, 2012 at 05:16:06PM +0200, Peter Zijlstra wrote: > On Tue, 2012-08-21 at 16:52 +0300, Michael S. Tsirkin wrote: > > > + rcu_read_lock(); > > > + mapping = rcu_dereference(page->mapping); > > > + if (mapping_balloon(mapping)) > > > + ret = true; > > > + rcu_read_unlock(); > > > > This looks suspicious: you drop rcu_read_unlock > > so can't page switch from balloon to non balloon? > > RCU read lock is a non-exclusive lock, it cannot avoid anything like > that. You are right, of course. So even keeping rcu_read_lock across both test and operation won't be enough - you need to make this function return the mapping and pass it to isolate_page/putback_page so that it is only dereferenced once. -- MST -- 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: email@kvack.org