Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755019AbaGDHwx (ORCPT ); Fri, 4 Jul 2014 03:52:53 -0400 Received: from lgeamrelo01.lge.com ([156.147.1.125]:43258 "EHLO lgeamrelo01.lge.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752839AbaGDHwv (ORCPT ); Fri, 4 Jul 2014 03:52:51 -0400 X-Original-SENDERIP: 10.177.220.145 X-Original-MAILFROM: iamjoonsoo.kim@lge.com From: Joonsoo Kim To: Andrew Morton Cc: "Kirill A. Shutemov" , Rik van Riel , Peter Zijlstra , Mel Gorman , Johannes Weiner , Minchan Kim , Yasuaki Ishimatsu , Zhang Yanfei , "Srivatsa S. Bhat" , 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, Joonsoo Kim Subject: [PATCH 07/10] mm/page_alloc: store migratetype of the buddy list into freepage correctly Date: Fri, 4 Jul 2014 16:57:52 +0900 Message-Id: <1404460675-24456-8-git-send-email-iamjoonsoo.kim@lge.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1404460675-24456-1-git-send-email-iamjoonsoo.kim@lge.com> References: <1404460675-24456-1-git-send-email-iamjoonsoo.kim@lge.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Whenever page is splited or merged, we don't set migratetype to new page, so there can be no accurate onbuddy_migratetype information. To maintain it correctly, we should reset whenever page order is changed. I think that set_page_order() is the best place to do, because it is called whenever page is merged or splited. Hence, this patch adds set_onbuddy_migratetype() to set_page_order(). And this patch makes set/get_onbuddy_migratetype() only enabled if memory isolation is enabeld, because it doesn't needed in other case. Signed-off-by: Joonsoo Kim --- include/linux/mm.h | 6 ++++++ mm/page_alloc.c | 9 +++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index 278ecfd..b35bd3b 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -281,6 +281,7 @@ struct inode; #define page_private(page) ((page)->private) #define set_page_private(page, v) ((page)->private = (v)) +#if defined(CONFIG_MEMORY_ISOLATION) static inline void set_onbuddy_migratetype(struct page *page, int migratetype) { page->index = migratetype; @@ -294,6 +295,11 @@ static inline int get_onbuddy_migratetype(struct page *page) { return page->index; } +#else +static inline void set_onbuddy_migratetype(struct page *page, + int migratetype) {} +static inline int get_onbuddy_migratetype(struct page *page) { return 0; } +#endif static inline void set_onpcp_migratetype(struct page *page, int migratetype) { diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 9d8ba2d..e1c4c3e 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -465,9 +465,11 @@ static inline void clear_page_guard(struct zone *zone, struct page *page, unsigned int order, int migratetype) {} #endif -static inline void set_page_order(struct page *page, unsigned int order) +static inline void set_page_order(struct page *page, unsigned int order, + int migratetype) { set_page_private(page, order); + set_onbuddy_migratetype(page, migratetype); __SetPageBuddy(page); } @@ -633,7 +635,7 @@ static inline void __free_one_page(struct page *page, page_idx = combined_idx; order++; } - set_page_order(page, order); + set_page_order(page, order, migratetype); /* * If this is not the largest possible page, check if the buddy @@ -797,7 +799,6 @@ static void __free_pages_ok(struct page *page, unsigned int order) migratetype = get_pfnblock_migratetype(page, pfn); local_irq_save(flags); __count_vm_events(PGFREE, 1 << order); - set_onbuddy_migratetype(page, migratetype); free_one_page(page_zone(page), page, pfn, order, migratetype); local_irq_restore(flags); } @@ -943,7 +944,7 @@ static inline void expand(struct zone *zone, struct page *page, #endif list_add(&page[size].lru, &area->free_list[migratetype]); area->nr_free++; - set_page_order(&page[size], high); + set_page_order(&page[size], high, migratetype); } } -- 1.7.9.5 -- 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/