From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755357Ab3AVRMq (ORCPT ); Tue, 22 Jan 2013 12:12:46 -0500 Received: from cantor2.suse.de ([195.135.220.15]:33328 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754740Ab3AVRMl (ORCPT ); Tue, 22 Jan 2013 12:12:41 -0500 From: Mel Gorman To: Andrew Morton Cc: Peter Zijlstra , Andrea Arcangeli , Ingo Molnar , Simon Jeons , Wanpeng Li , Hugh Dickins , Mel Gorman , Linux-MM , LKML Subject: [PATCH 2/6] mm: numa: Take THP into account when migrating pages for NUMA balancing Date: Tue, 22 Jan 2013 17:12:38 +0000 Message-Id: <1358874762-19717-3-git-send-email-mgorman@suse.de> X-Mailer: git-send-email 1.7.9.2 In-Reply-To: <1358874762-19717-1-git-send-email-mgorman@suse.de> References: <1358874762-19717-1-git-send-email-mgorman@suse.de> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Wanpeng Li pointed out that numamigrate_isolate_page() assumes that only one base page is being migrated when in fact it can also be checking THP. The consequences are that a migration will be attempted when a target node is nearly full and fail later. It's unlikely to be user-visible but it should be fixed. While we are there, migrate_balanced_pgdat() should treat nr_migrate_pages as an unsigned long as it is treated as a watermark. Suggested-by: Wanpeng Li Signed-off-by: Mel Gorman --- mm/migrate.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mm/migrate.c b/mm/migrate.c index c387786..73e432d 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -1459,7 +1459,7 @@ int migrate_vmas(struct mm_struct *mm, const nodemask_t *to, * pages. Currently it only checks the watermarks which crude */ static bool migrate_balanced_pgdat(struct pglist_data *pgdat, - int nr_migrate_pages) + unsigned long nr_migrate_pages) { int z; for (z = pgdat->nr_zones - 1; z >= 0; z--) { @@ -1557,8 +1557,10 @@ int numamigrate_isolate_page(pg_data_t *pgdat, struct page *page) { int ret = 0; + VM_BUG_ON(compound_order(page) && !PageTransHuge(page)); + /* Avoid migrating to a node that is nearly full */ - if (migrate_balanced_pgdat(pgdat, 1)) { + if (migrate_balanced_pgdat(pgdat, 1UL << compound_order(page))) { int page_lru; if (isolate_lru_page(page)) { -- 1.7.9.2 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from psmtp.com (na3sys010amx105.postini.com [74.125.245.105]) by kanga.kvack.org (Postfix) with SMTP id 2CB136B000E for ; Tue, 22 Jan 2013 12:12:42 -0500 (EST) From: Mel Gorman Subject: [PATCH 2/6] mm: numa: Take THP into account when migrating pages for NUMA balancing Date: Tue, 22 Jan 2013 17:12:38 +0000 Message-Id: <1358874762-19717-3-git-send-email-mgorman@suse.de> In-Reply-To: <1358874762-19717-1-git-send-email-mgorman@suse.de> References: <1358874762-19717-1-git-send-email-mgorman@suse.de> Sender: owner-linux-mm@kvack.org List-ID: To: Andrew Morton Cc: Peter Zijlstra , Andrea Arcangeli , Ingo Molnar , Simon Jeons , Wanpeng Li , Hugh Dickins , Mel Gorman , Linux-MM , LKML Wanpeng Li pointed out that numamigrate_isolate_page() assumes that only one base page is being migrated when in fact it can also be checking THP. The consequences are that a migration will be attempted when a target node is nearly full and fail later. It's unlikely to be user-visible but it should be fixed. While we are there, migrate_balanced_pgdat() should treat nr_migrate_pages as an unsigned long as it is treated as a watermark. Suggested-by: Wanpeng Li Signed-off-by: Mel Gorman --- mm/migrate.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mm/migrate.c b/mm/migrate.c index c387786..73e432d 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -1459,7 +1459,7 @@ int migrate_vmas(struct mm_struct *mm, const nodemask_t *to, * pages. Currently it only checks the watermarks which crude */ static bool migrate_balanced_pgdat(struct pglist_data *pgdat, - int nr_migrate_pages) + unsigned long nr_migrate_pages) { int z; for (z = pgdat->nr_zones - 1; z >= 0; z--) { @@ -1557,8 +1557,10 @@ int numamigrate_isolate_page(pg_data_t *pgdat, struct page *page) { int ret = 0; + VM_BUG_ON(compound_order(page) && !PageTransHuge(page)); + /* Avoid migrating to a node that is nearly full */ - if (migrate_balanced_pgdat(pgdat, 1)) { + if (migrate_balanced_pgdat(pgdat, 1UL << compound_order(page))) { int page_lru; if (isolate_lru_page(page)) { -- 1.7.9.2 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org