Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751990AbbKZKjN (ORCPT ); Thu, 26 Nov 2015 05:39:13 -0500 Received: from mx2.suse.de ([195.135.220.15]:54832 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750801AbbKZKjK (ORCPT ); Thu, 26 Nov 2015 05:39:10 -0500 Subject: Re: [PATCH v2 5/9] mm, page_owner: track and print last migrate reason To: Joonsoo Kim References: <1448368581-6923-1-git-send-email-vbabka@suse.cz> <1448368581-6923-6-git-send-email-vbabka@suse.cz> <20151125081323.GB10494@js1304-P5Q-DELUXE> Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrew Morton , Minchan Kim , Sasha Levin , "Kirill A. Shutemov" , Mel Gorman , Michal Hocko From: Vlastimil Babka Message-ID: <5656E14A.1020508@suse.cz> Date: Thu, 26 Nov 2015 11:39:06 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <20151125081323.GB10494@js1304-P5Q-DELUXE> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3012 Lines: 104 On 11/25/2015 09:13 AM, Joonsoo Kim wrote: >> + if (page_ext->last_migrate_reason != -1) { >> + ret += snprintf(kbuf + ret, count - ret, >> + "Page has been migrated, last migrate reason: %s\n", >> + migrate_reason_names[page_ext->last_migrate_reason]); >> + if (ret >= count) >> + goto err; >> + } >> + > > migrate_reason_names is defined if CONFIG_MIGRATION is enabled so > it would cause build failure in case of !CONFIG_MIGRATION and > CONFIG_PAGE_OWNER. > > Thanks. Ugh right, linking gives warnings... Thanks. I think instead of adding #ifdefs here, let's move migrate_reason_names to mm/debug.c as we gradually do with these things. Also enum migrate_reason is defined regardless of CONFIG_MIGRATION, so match that for migrate_reason_names as well. ------8<------ >From 7b650fd613ed382aaa6f11f4b779e883a6af10aa Mon Sep 17 00:00:00 2001 From: Vlastimil Babka Date: Thu, 26 Nov 2015 11:31:09 +0100 Subject: mm, page_owner: track and print last migrate reason-fix Move migrate_reason_names from mm/migrate.c to mm/debug.c so that link doesn't warn with CONFIG_MIGRATION disabled. --- include/linux/migrate.h | 2 +- mm/debug.c | 11 +++++++++++ mm/migrate.c | 10 ---------- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/include/linux/migrate.h b/include/linux/migrate.h index ab92a8cf4c93..8fdc033e527a 100644 --- a/include/linux/migrate.h +++ b/include/linux/migrate.h @@ -27,7 +27,7 @@ enum migrate_reason { MR_TYPES }; -/* In mm/migrate.c; also keep sync with include/trace/events/migrate.h */ +/* In mm/debug.c; also keep sync with include/trace/events/migrate.h */ extern char * migrate_reason_names[MR_TYPES]; #ifdef CONFIG_MIGRATION diff --git a/mm/debug.c b/mm/debug.c index d9718fc8377a..a4cd0c093ff6 100644 --- a/mm/debug.c +++ b/mm/debug.c @@ -9,6 +9,17 @@ #include #include #include +#include + +char *migrate_reason_names[MR_TYPES] = { + "compaction", + "memory_failure", + "memory_hotplug", + "syscall_or_cpuset", + "mempolicy_mbind", + "numa_misplaced", + "cma", +}; static const struct trace_print_flags pageflag_names[] = { {1UL << PG_locked, "locked" }, diff --git a/mm/migrate.c b/mm/migrate.c index 12e9ab9de446..1c11b73cd834 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -47,16 +47,6 @@ #include "internal.h" -char *migrate_reason_names[MR_TYPES] = { - "compaction", - "memory_failure", - "memory_hotplug", - "syscall_or_cpuset", - "mempolicy_mbind", - "numa_misplaced", - "cma", -}; - /* * migrate_prep() needs to be called before we start compiling a list of pages * to be migrated using isolate_lru_page(). If scheduling work on other CPUs is -- 2.6.3 -- 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/