Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751234AbaKCI3K (ORCPT ); Mon, 3 Nov 2014 03:29:10 -0500 Received: from cantor2.suse.de ([195.135.220.15]:42508 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751084AbaKCI3I (ORCPT ); Mon, 3 Nov 2014 03:29:08 -0500 Message-ID: <54573CCE.2090800@suse.cz> Date: Mon, 03 Nov 2014 09:29:02 +0100 From: Vlastimil Babka User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.1.0 MIME-Version: 1.0 To: Joonsoo Kim CC: Andrew Morton , "Kirill A. Shutemov" , Rik van Riel , Peter Zijlstra , Mel Gorman , Johannes Weiner , Minchan Kim , Yasuaki Ishimatsu , Zhang Yanfei , Tang Chen , Naoya Horiguchi , Bartlomiej Zolnierkiewicz , Wen Congyang , Marek Szyprowski , Michal Nazarewicz , Laura Abbott , Heesub Shin , "Aneesh Kumar K.V" , Ritesh Harjani , t.stanislaws@samsung.com, Gioh Kim , linux-mm@kvack.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH v5 4/4] mm/page_alloc: restrict max order of merging on isolated pageblock References: <1414740330-4086-1-git-send-email-iamjoonsoo.kim@lge.com> <1414740330-4086-5-git-send-email-iamjoonsoo.kim@lge.com> <54539F11.7080501@suse.cz> <20141103081031.GC7052@js1304-P5Q-DELUXE> In-Reply-To: <20141103081031.GC7052@js1304-P5Q-DELUXE> 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 11/03/2014 09:10 AM, Joonsoo Kim wrote: > On Fri, Oct 31, 2014 at 03:39:13PM +0100, Vlastimil Babka wrote: >>> + __isolate_free_page(page, order); >>> + set_page_refcounted(page); >>> + isolated_page = page; >>> + } >>> + } >>> + } >>> nr_pages = move_freepages_block(zone, page, migratetype); >> >> - this is a costly no-op when the whole pageblock is an isolated >> page, right? > > Okay. I will fix it. > >> >>> __mod_zone_freepage_state(zone, nr_pages, migratetype); >> >> - with isolated_page set, this means you increase freepage_state >> here, and then the second time in __free_pages() below? >> __isolate_free_page() won't decrease it as the pageblock is still >> MIGRATE_ISOLATE, so the net result is overcounting? > > After __isolate_free_page(), freepage has no buddy flag and > move_freepages_block() doesn't move and count it. So, freepage_state > only increase in __free_pages(). So net result will be correct. Ah right, I forgot that it gets nr_pages from the move_freepages_block() result (which is 0 in this case). > Below is the update for your comment. > > Thanks. > > ------------>8---------------- > From 4bf298908aba16935c7699589c60d00fa0cf389c Mon Sep 17 00:00:00 2001 > From: Joonsoo Kim > Date: Mon, 25 Aug 2014 09:52:13 +0900 > Subject: [PATCH v6 4/4] mm/page_alloc: restrict max order of merging on isolated > pageblock > > Current pageblock isolation logic could isolate each pageblock > individually. This causes freepage accounting problem if freepage with > pageblock order on isolate pageblock is merged with other freepage on > normal pageblock. We can prevent merging by restricting max order of > merging to pageblock order if freepage is on isolate pageblock. > > Side-effect of this change is that there could be non-merged buddy > freepage even if finishing pageblock isolation, because undoing pageblock > isolation is just to move freepage from isolate buddy list to normal buddy > list rather than to consider merging. So, the patch also makes undoing > pageblock isolation consider freepage merge. When un-isolation, freepage > with more than pageblock order and it's buddy are checked. If they are > on normal pageblock, instead of just moving, we isolate the freepage and > free it in order to get merged. > > Changes from v5: > Avoid costly move_freepages_block() if there is no freepage. > Some cosmetic changes. > > Changes from v4: > Consider merging on un-isolation process. > > Cc: > Signed-off-by: Joonsoo Kim Acked-by: Vlastimil Babka -- 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/