[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5656E14A.1020508@suse.cz>
Date: Thu, 26 Nov 2015 11:39:06 +0100
From: Vlastimil Babka <vbabka@...e.cz>
To: Joonsoo Kim <iamjoonsoo.kim@....com>
Cc: linux-mm@...ck.org, linux-kernel@...r.kernel.org,
Andrew Morton <akpm@...ux-foundation.org>,
Minchan Kim <minchan@...nel.org>,
Sasha Levin <sasha.levin@...cle.com>,
"Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>,
Mel Gorman <mgorman@...e.de>, Michal Hocko <mhocko@...e.cz>
Subject: Re: [PATCH v2 5/9] mm, page_owner: track and print last migrate
reason
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 <vbabka@...e.cz>
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 <linux/mm.h>
#include <linux/trace_events.h>
#include <linux/memcontrol.h>
+#include <linux/migrate.h>
+
+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@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists