From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753710AbbJPKQh (ORCPT ); Fri, 16 Oct 2015 06:16:37 -0400 Received: from szxga01-in.huawei.com ([58.251.152.64]:10941 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752034AbbJPKQf (ORCPT ); Fri, 16 Oct 2015 06:16:35 -0400 Message-ID: <5620CDA3.9050006@huawei.com> Date: Fri, 16 Oct 2015 18:12:51 +0800 From: Xishi Qiu User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:12.0) Gecko/20120428 Thunderbird/12.0.1 MIME-Version: 1.0 To: Andrew Morton , Vlastimil Babka , Mel Gorman , , , Johannes Weiner , , CC: Linux MM , LKML Subject: Re: [PATCH] mm: reset migratetype if the range spans two pageblocks References: <5620CC36.4090107@huawei.com> In-Reply-To: <5620CC36.4090107@huawei.com> Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.177.25.179] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2015/10/16 18:06, Xishi Qiu wrote: > __rmqueue_fallback() will change the migratetype of pageblock, > so it is possible that two continuous pageblocks have different > migratetypes. > > When freeing all pages of the two blocks, they will be merged > to 4M, and added to the buddy list which the migratetype is the > first pageblock's. > > If later alloc some pages and split the 4M, the second pageblock > will be added to the buddy list, and the migratetype is the first > pageblock's, so it is different from the its pageblock's. > > That means the page in buddy list's migratetype is different from > the page in pageblock's migratetype. This will make confusion. > > However,if we change the hotpath, it will be performance degradation, > so any better ideas? > How about using get_pfnblock_migratetype() to get the pageblock's migratetype first, and compare them? Thanks, Xishi Qiu > Signed-off-by: Xishi Qiu > --- > mm/page_alloc.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/mm/page_alloc.c b/mm/page_alloc.c > index 48aaf7b..5c91348 100644 > --- a/mm/page_alloc.c > +++ b/mm/page_alloc.c > @@ -726,6 +726,9 @@ static inline void __free_one_page(struct page *page, > list_add(&page->lru, &zone->free_area[order].free_list[migratetype]); > out: > zone->free_area[order].nr_free++; > + /* If the range spans two pageblocks, reset the migratetype. */ > + if (order > pageblock_order) > + change_pageblock_range(page, order, migratetype); > } > > static inline int free_pages_check(struct page *page)