From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752796Ab2GBMlL (ORCPT ); Mon, 2 Jul 2012 08:41:11 -0400 Received: from cantor2.suse.de ([195.135.220.15]:37126 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752408Ab2GBMlJ (ORCPT ); Mon, 2 Jul 2012 08:41:09 -0400 Date: Mon, 2 Jul 2012 13:41:03 +0100 From: Mel Gorman To: Jiang Liu Cc: Andrew Morton , Tony Luck , Yinghai Lu , Xishi Qiu , KAMEZAWA Hiroyuki , KOSAKI Motohiro , David Rientjes , Minchan Kim , Keping Chen , linux-mm@kvack.org, stable@vger.kernel.org, linux-kernel@vger.kernel.org, Jiang Liu Subject: Re: [PATCH] mm: setup pageblock_order before it's used by sparse Message-ID: <20120702124103.GP14154@suse.de> References: <1341047274-5616-1-git-send-email-jiang.liu@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: <1341047274-5616-1-git-send-email-jiang.liu@huawei.com> 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 On Sat, Jun 30, 2012 at 05:07:54PM +0800, Jiang Liu wrote: > From: Xishi Qiu > > On architectures with CONFIG_HUGETLB_PAGE_SIZE_VARIABLE set, such as Itanium, > pageblock_order is a variable with default value of 0. It's set to the right > value by set_pageblock_order() in function free_area_init_core(). > > But pageblock_order may be used by sparse_init() before free_area_init_core() > is called along path: > sparse_init() > ->sparse_early_usemaps_alloc_node() > ->usemap_size() > ->SECTION_BLOCKFLAGS_BITS > ->((1UL << (PFN_SECTION_SHIFT - pageblock_order)) * > NR_PAGEBLOCK_BITS) > > The uninitialized pageblock_size will cause memory wasting because usemap_size() > returns a much bigger value then it's really needed. > > For example, on an Itanium platform, > sparse_init() pageblock_order=0 usemap_size=24576 > free_area_init_core() before pageblock_order=0, usemap_size=24576 > free_area_init_core() after pageblock_order=12, usemap_size=8 > > That means 24K memory has been wasted for each section, so fix it by calling > set_pageblock_order() from sparse_init(). > > Signed-off-by: Xishi Qiu > Signed-off-by: Jiang Liu Looks all right. Acked-by: Mel Gorman This should be considered a stable candidate. Add Cc: stable above your Signed-off-by and it'll get picked up if the patch is merged to mainline. -- Mel Gorman SUSE Labs