From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757652Ab2HUPhx (ORCPT ); Tue, 21 Aug 2012 11:37:53 -0400 Received: from casper.infradead.org ([85.118.1.10]:47438 "EHLO casper.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756577Ab2HUPh2 convert rfc822-to-8bit (ORCPT ); Tue, 21 Aug 2012 11:37:28 -0400 Message-ID: <1345563433.26596.2.camel@twins> Subject: Re: [PATCH v8 3/5] virtio_balloon: introduce migration primitives to balloon pages From: Peter Zijlstra To: "Michael S. Tsirkin" 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 , paulmck Date: Tue, 21 Aug 2012 17:37:13 +0200 In-Reply-To: <20120821144013.GA7784@redhat.com> References: <20120821144013.GA7784@redhat.com> Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7BIT X-Mailer: Evolution 3.2.2- Mime-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 2012-08-21 at 17:40 +0300, Michael S. Tsirkin wrote: > > + spin_lock(&vb->pages_lock); > > + page = list_first_or_null_rcu(&vb->pages, struct page, lru); > > Why is list_first_or_null_rcu called outside > RCU critical section here? It looks like vb->pages_lock is the exclusive (or modification) counterpart to the rcu-read-lock in this particular case, so it should be fine. Although for that same reason, it seems superfluous to use the RCU list method since we're exclusive with list manipulations anyway. > > + if (!page) { > > + spin_unlock(&vb->pages_lock); > > + break; > > + } > > + /* > > + * It is safe now to drop page->mapping and delete this page > > + * from balloon page list, since we are grabbing 'pages_lock' > > + * which prevents 'virtballoon_isolatepage()' from acting. > > + */ > > + clear_balloon_mapping(page); > > + list_del_rcu(&page->lru); > > + spin_unlock(&vb->pages_lock);