From 08e6ab0a604d6caf899ca898ad18c8aa6c464e0a Mon Sep 17 00:00:00 2001 From: Trilok Soni Date: Wed, 20 Apr 2016 18:12:51 -0700 Subject: [PATCH] mm/page_owner: ask users about default setting of PAGE_OWNER Since this commit 48c96a3685795 ("mm/page_owner: keep track of page owners") doesn't enable the page_owner by default even though CONFIG_PAGE_OWNER is enabled. Add configuration option CONFIG_PAGE_OWNER_ENABLE_DEFAULT to allow user to enable it by default through the defconfig file. CRs-Fixed: 1006743 Change-Id: I9b565a34e2068bf575974eaf3dc9f7820bdd7a96 Signed-off-by: Trilok Soni Signed-off-by: Patrick Daly [swatsrid@codeaurora.org: Fix merge errors and warnings] Signed-off-by: Swathi Sridhar [isaacm@codeaurora.org: Fix merge conflicts] Signed-off-by: Isaac J. Manjarres --- mm/Kconfig.debug | 11 +++++++++++ mm/page_owner.c | 6 +++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/mm/Kconfig.debug b/mm/Kconfig.debug index 82b6a20898bd..40024f028629 100644 --- a/mm/Kconfig.debug +++ b/mm/Kconfig.debug @@ -60,6 +60,17 @@ config PAGE_OWNER If unsure, say N. +config PAGE_OWNER_ENABLE_DEFAULT + bool "Enable Track page owner by default" + depends on PAGE_OWNER + help + This keeps track of what call chain is the owner of a page, may + help to find bare alloc_page(s) leaks. If you include this + feature on your build, it is enabled by default. You should pass + "page_owner=off" to boot parameter in order to disable it. Eats + a fair amount of memory if enabled. See tools/vm/page_owner_sort.c + for user-space helper. + config PAGE_POISONING bool "Poison pages after freeing" select PAGE_POISONING_NO_SANITY if HIBERNATION diff --git a/mm/page_owner.c b/mm/page_owner.c index addcbb2ae4e4..8689b4768a3c 100644 --- a/mm/page_owner.c +++ b/mm/page_owner.c @@ -26,7 +26,8 @@ struct page_owner { depot_stack_handle_t handle; }; -static bool page_owner_disabled = true; +static bool page_owner_disabled = + !IS_ENABLED(CONFIG_PAGE_OWNER_ENABLE_DEFAULT); DEFINE_STATIC_KEY_FALSE(page_owner_inited); static depot_stack_handle_t dummy_handle; @@ -43,6 +44,9 @@ static int __init early_page_owner_param(char *buf) if (strcmp(buf, "on") == 0) page_owner_disabled = false; + if (strcmp(buf, "off") == 0) + page_owner_disabled = true; + return 0; } early_param("page_owner", early_page_owner_param);