Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753626Ab2KGWDa (ORCPT ); Wed, 7 Nov 2012 17:03:30 -0500 Received: from mx1.redhat.com ([209.132.183.28]:9993 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751727Ab2KGWD3 (ORCPT ); Wed, 7 Nov 2012 17:03:29 -0500 Date: Wed, 7 Nov 2012 20:02:56 -0200 From: Rafael Aquini To: Andrew Morton Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org, Rusty Russell , "Michael S. Tsirkin" , Rik van Riel , Mel Gorman , Andi Kleen , Konrad Rzeszutek Wilk , Minchan Kim , Peter Zijlstra , "Paul E. McKenney" Subject: Re: [PATCH v11 5/7] virtio_balloon: introduce migration primitives to balloon pages Message-ID: <20121107220255.GC10444@optiplex.redhat.com> References: <265aaff9a79f503672f0cdcdff204114b5b5ba5b.1352256088.git.aquini@redhat.com> <20121107115810.1ae286ac.akpm@linux-foundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20121107115810.1ae286ac.akpm@linux-foundation.org> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2713 Lines: 65 On Wed, Nov 07, 2012 at 11:58:10AM -0800, Andrew Morton wrote: > On Wed, 7 Nov 2012 01:05:52 -0200 > Rafael Aquini wrote: > > > Memory fragmentation introduced by ballooning might reduce significantly > > the number of 2MB contiguous memory blocks that can be used within a guest, > > thus imposing performance penalties associated with the reduced number of > > transparent huge pages that could be used by the guest workload. > > > > Besides making balloon pages movable at allocation time and introducing > > the necessary primitives to perform balloon page migration/compaction, > > this patch also introduces the following locking scheme, in order to > > enhance the syncronization methods for accessing elements of struct > > virtio_balloon, thus providing protection against concurrent access > > introduced by parallel memory migration threads. > > > > ... > > > > @@ -122,18 +128,25 @@ static void set_page_pfns(u32 pfns[], struct page *page) > > > > static void fill_balloon(struct virtio_balloon *vb, size_t num) > > { > > + struct balloon_dev_info *vb_dev_info = vb->vb_dev_info; > > + > > + static DEFINE_RATELIMIT_STATE(fill_balloon_rs, > > + DEFAULT_RATELIMIT_INTERVAL, > > + DEFAULT_RATELIMIT_BURST); > > + > > /* We can only do one array worth at a time. */ > > num = min(num, ARRAY_SIZE(vb->pfns)); > > > > + mutex_lock(&vb->balloon_lock); > > for (vb->num_pfns = 0; vb->num_pfns < num; > > vb->num_pfns += VIRTIO_BALLOON_PAGES_PER_PAGE) { > > - struct page *page = alloc_page(GFP_HIGHUSER | __GFP_NORETRY | > > - __GFP_NOMEMALLOC | __GFP_NOWARN); > > + struct page *page = balloon_page_enqueue(vb_dev_info); > > + > > if (!page) { > > - if (printk_ratelimit()) > > + if (__ratelimit(&fill_balloon_rs)) > > dev_printk(KERN_INFO, &vb->vdev->dev, > > "Out of puff! Can't get %zu pages\n", > > - num); > > + VIRTIO_BALLOON_PAGES_PER_PAGE); > > /* Sleep for at least 1/5 of a second before retry. */ > > msleep(200); > > break; > > linux-next's fill_balloon() has already been converted to > dev_info_ratelimited(). I fixed everything up. Please check the result. Looks great, thanks for doing it > > -- > 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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/