diff options
author | Vlastimil Babka <vbabka@suse.cz> | 2016-03-15 14:56:12 -0700 |
---|---|---|
committer | Prakash Gupta <guptap@codeaurora.org> | 2017-07-07 15:12:09 +0530 |
commit | 2e58c8c7ee361f01d48d949da1f09a55c3d4e42d (patch) | |
tree | 7afeda25eb9bd7793648e26558c50f772191c280 /mm | |
parent | 188f10f240d08a24a6ad1d96bd5b3038ce1dd05b (diff) |
mm, page_owner: convert page_owner_inited to static key
CONFIG_PAGE_OWNER attempts to impose negligible runtime overhead when
enabled during compilation, but not actually enabled during runtime by
boot param page_owner=on. This overhead can be further reduced using
the static key mechanism, which this patch does.
Change-Id: I76e44d92ed973647d4fd6489f97db5ffeb893354
Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
Acked-by: Michal Hocko <mhocko@suse.com>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Sasha Levin <sasha.levin@oracle.com>
Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
Cc: Mel Gorman <mgorman@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Git-commit: 7dd80b8af0bcd705a9ef2fa272c082882616a499
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
[guptap@codeaurora.org: resolve trivial merge conflicts]
Signed-off-by: Prakash Gupta <guptap@codeaurora.org>
Diffstat (limited to 'mm')
-rw-r--r-- | mm/page_owner.c | 9 | ||||
-rw-r--r-- | mm/vmstat.c | 2 |
2 files changed, 6 insertions, 5 deletions
diff --git a/mm/page_owner.c b/mm/page_owner.c index 23dcb2252c13..e20cddb78349 100644 --- a/mm/page_owner.c +++ b/mm/page_owner.c @@ -5,11 +5,12 @@ #include <linux/bootmem.h> #include <linux/stacktrace.h> #include <linux/page_owner.h> +#include <linux/jump_label.h> #include "internal.h" static bool page_owner_disabled = !IS_ENABLED(CONFIG_PAGE_OWNER_ENABLE_DEFAULT); -bool page_owner_inited __read_mostly; +DEFINE_STATIC_KEY_FALSE(page_owner_inited); static void init_early_allocated_pages(void); @@ -41,7 +42,7 @@ static void init_page_owner(void) if (page_owner_disabled) return; - page_owner_inited = true; + static_branch_enable(&page_owner_inited); init_early_allocated_pages(); } @@ -151,7 +152,7 @@ read_page_owner(struct file *file, char __user *buf, size_t count, loff_t *ppos) struct page *page; struct page_ext *page_ext; - if (!page_owner_inited) + if (!static_branch_unlikely(&page_owner_inited)) return -EINVAL; page = NULL; @@ -299,7 +300,7 @@ static int __init pageowner_init(void) { struct dentry *dentry; - if (!page_owner_inited) { + if (!static_branch_unlikely(&page_owner_inited)) { pr_info("page_owner is disabled\n"); return 0; } diff --git a/mm/vmstat.c b/mm/vmstat.c index 068ab4d2c776..1ba56d5de7e6 100644 --- a/mm/vmstat.c +++ b/mm/vmstat.c @@ -1127,7 +1127,7 @@ static void pagetypeinfo_showmixedcount(struct seq_file *m, pg_data_t *pgdat) #ifdef CONFIG_PAGE_OWNER int mtype; - if (!page_owner_inited) + if (!static_branch_unlikely(&page_owner_inited)) return; drain_all_pages(NULL); |