From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752273AbdDNC3O (ORCPT ); Thu, 13 Apr 2017 22:29:14 -0400 Received: from mga03.intel.com ([134.134.136.65]:42971 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752192AbdDNC3L (ORCPT ); Thu, 13 Apr 2017 22:29:11 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.37,195,1488873600"; d="scan'208";a="88735043" Message-ID: <58F03443.9040202@intel.com> Date: Fri, 14 Apr 2017 10:30:27 +0800 From: Wei Wang User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Andrew Morton CC: virtio-dev@lists.oasis-open.org, linux-kernel@vger.kernel.org, qemu-devel@nongnu.org, virtualization@lists.linux-foundation.org, kvm@vger.kernel.org, linux-mm@kvack.org, mst@redhat.com, david@redhat.com, dave.hansen@intel.com, cornelia.huck@de.ibm.com, mgorman@techsingularity.net, aarcange@redhat.com, amit.shah@redhat.com, pbonzini@redhat.com, liliang.opensource@gmail.com Subject: Re: [PATCH v9 3/5] mm: function to offer a page block on the free list References: <1492076108-117229-1-git-send-email-wei.w.wang@intel.com> <1492076108-117229-4-git-send-email-wei.w.wang@intel.com> <20170413130217.2316b0394192d8677f5ddbdf@linux-foundation.org> In-Reply-To: <20170413130217.2316b0394192d8677f5ddbdf@linux-foundation.org> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 04/14/2017 04:02 AM, Andrew Morton wrote: > On Thu, 13 Apr 2017 17:35:06 +0800 Wei Wang wrote: > >> Add a function to find a page block on the free list specified by the >> caller. Pages from the page block may be used immediately after the >> function returns. The caller is responsible for detecting or preventing >> the use of such pages. >> >> ... >> >> --- a/mm/page_alloc.c >> +++ b/mm/page_alloc.c >> @@ -4498,6 +4498,93 @@ void show_free_areas(unsigned int filter) >> show_swap_cache_info(); >> } >> >> +/** >> + * Heuristically get a page block in the system that is unused. >> + * It is possible that pages from the page block are used immediately after >> + * inquire_unused_page_block() returns. It is the caller's responsibility >> + * to either detect or prevent the use of such pages. >> + * >> + * The free list to check: zone->free_area[order].free_list[migratetype]. >> + * >> + * If the caller supplied page block (i.e. **page) is on the free list, offer >> + * the next page block on the list to the caller. Otherwise, offer the first >> + * page block on the list. >> + * >> + * Return 0 when a page block is found on the caller specified free list. >> + */ >> +int inquire_unused_page_block(struct zone *zone, unsigned int order, >> + unsigned int migratetype, struct page **page) >> +{ > Perhaps we can wrap this in the appropriate ifdef so the kernels which > won't be using virtio-balloon don't carry the added overhead. > > OK. What do you think if we add this: #if defined(CONFIG_VIRTIO_BALLOON) || defined(CONFIG_VIRTIO_BALLOON_MODULE) Best, Wei