2009-04-01 06:23:17 +08:00
|
|
|
#include <linux/kernel.h>
|
2011-11-01 08:08:10 +08:00
|
|
|
#include <linux/string.h>
|
2009-04-01 06:23:17 +08:00
|
|
|
#include <linux/mm.h>
|
2011-11-01 08:08:38 +08:00
|
|
|
#include <linux/highmem.h>
|
mm/debug-pagealloc: prepare boottime configurable on/off
Until now, debug-pagealloc needs extra flags in struct page, so we need to
recompile whole source code when we decide to use it. This is really
painful, because it takes some time to recompile and sometimes rebuild is
not possible due to third party module depending on struct page. So, we
can't use this good feature in many cases.
Now, we have the page extension feature that allows us to insert extra
flags to outside of struct page. This gets rid of third party module
issue mentioned above. And, this allows us to determine if we need extra
memory for this page extension in boottime. With these property, we can
avoid using debug-pagealloc in boottime with low computational overhead in
the kernel built with CONFIG_DEBUG_PAGEALLOC. This will help our
development process greatly.
This patch is the preparation step to achive above goal. debug-pagealloc
originally uses extra field of struct page, but, after this patch, it will
use field of struct page_ext. Because memory for page_ext is allocated
later than initialization of page allocator in CONFIG_SPARSEMEM, we should
disable debug-pagealloc feature temporarily until initialization of
page_ext. This patch implements this.
Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Dave Hansen <dave@sr71.net>
Cc: Michal Nazarewicz <mina86@mina86.com>
Cc: Jungsoo Son <jungsoo.son@lge.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2014-12-13 08:55:49 +08:00
|
|
|
#include <linux/page_ext.h>
|
2009-04-01 06:23:17 +08:00
|
|
|
#include <linux/poison.h>
|
2011-11-01 08:08:05 +08:00
|
|
|
#include <linux/ratelimit.h>
|
2009-04-01 06:23:17 +08:00
|
|
|
|
2016-03-16 05:56:27 +08:00
|
|
|
static bool __page_poisoning_enabled __read_mostly;
|
|
|
|
static bool want_page_poisoning __read_mostly;
|
mm/debug-pagealloc: prepare boottime configurable on/off
Until now, debug-pagealloc needs extra flags in struct page, so we need to
recompile whole source code when we decide to use it. This is really
painful, because it takes some time to recompile and sometimes rebuild is
not possible due to third party module depending on struct page. So, we
can't use this good feature in many cases.
Now, we have the page extension feature that allows us to insert extra
flags to outside of struct page. This gets rid of third party module
issue mentioned above. And, this allows us to determine if we need extra
memory for this page extension in boottime. With these property, we can
avoid using debug-pagealloc in boottime with low computational overhead in
the kernel built with CONFIG_DEBUG_PAGEALLOC. This will help our
development process greatly.
This patch is the preparation step to achive above goal. debug-pagealloc
originally uses extra field of struct page, but, after this patch, it will
use field of struct page_ext. Because memory for page_ext is allocated
later than initialization of page allocator in CONFIG_SPARSEMEM, we should
disable debug-pagealloc feature temporarily until initialization of
page_ext. This patch implements this.
Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Dave Hansen <dave@sr71.net>
Cc: Michal Nazarewicz <mina86@mina86.com>
Cc: Jungsoo Son <jungsoo.son@lge.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2014-12-13 08:55:49 +08:00
|
|
|
|
2016-03-16 05:56:27 +08:00
|
|
|
static int early_page_poison_param(char *buf)
|
mm/debug-pagealloc: prepare boottime configurable on/off
Until now, debug-pagealloc needs extra flags in struct page, so we need to
recompile whole source code when we decide to use it. This is really
painful, because it takes some time to recompile and sometimes rebuild is
not possible due to third party module depending on struct page. So, we
can't use this good feature in many cases.
Now, we have the page extension feature that allows us to insert extra
flags to outside of struct page. This gets rid of third party module
issue mentioned above. And, this allows us to determine if we need extra
memory for this page extension in boottime. With these property, we can
avoid using debug-pagealloc in boottime with low computational overhead in
the kernel built with CONFIG_DEBUG_PAGEALLOC. This will help our
development process greatly.
This patch is the preparation step to achive above goal. debug-pagealloc
originally uses extra field of struct page, but, after this patch, it will
use field of struct page_ext. Because memory for page_ext is allocated
later than initialization of page allocator in CONFIG_SPARSEMEM, we should
disable debug-pagealloc feature temporarily until initialization of
page_ext. This patch implements this.
Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Dave Hansen <dave@sr71.net>
Cc: Michal Nazarewicz <mina86@mina86.com>
Cc: Jungsoo Son <jungsoo.son@lge.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2014-12-13 08:55:49 +08:00
|
|
|
{
|
2016-03-16 05:56:27 +08:00
|
|
|
if (!buf)
|
|
|
|
return -EINVAL;
|
|
|
|
|
|
|
|
if (strcmp(buf, "on") == 0)
|
|
|
|
want_page_poisoning = true;
|
|
|
|
else if (strcmp(buf, "off") == 0)
|
|
|
|
want_page_poisoning = false;
|
2014-12-13 08:55:52 +08:00
|
|
|
|
2016-03-16 05:56:27 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
early_param("page_poison", early_page_poison_param);
|
|
|
|
|
|
|
|
bool page_poisoning_enabled(void)
|
|
|
|
{
|
|
|
|
return __page_poisoning_enabled;
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool need_page_poisoning(void)
|
|
|
|
{
|
|
|
|
return want_page_poisoning;
|
mm/debug-pagealloc: prepare boottime configurable on/off
Until now, debug-pagealloc needs extra flags in struct page, so we need to
recompile whole source code when we decide to use it. This is really
painful, because it takes some time to recompile and sometimes rebuild is
not possible due to third party module depending on struct page. So, we
can't use this good feature in many cases.
Now, we have the page extension feature that allows us to insert extra
flags to outside of struct page. This gets rid of third party module
issue mentioned above. And, this allows us to determine if we need extra
memory for this page extension in boottime. With these property, we can
avoid using debug-pagealloc in boottime with low computational overhead in
the kernel built with CONFIG_DEBUG_PAGEALLOC. This will help our
development process greatly.
This patch is the preparation step to achive above goal. debug-pagealloc
originally uses extra field of struct page, but, after this patch, it will
use field of struct page_ext. Because memory for page_ext is allocated
later than initialization of page allocator in CONFIG_SPARSEMEM, we should
disable debug-pagealloc feature temporarily until initialization of
page_ext. This patch implements this.
Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Dave Hansen <dave@sr71.net>
Cc: Michal Nazarewicz <mina86@mina86.com>
Cc: Jungsoo Son <jungsoo.son@lge.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2014-12-13 08:55:49 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void init_page_poisoning(void)
|
|
|
|
{
|
2016-03-16 05:56:27 +08:00
|
|
|
/*
|
|
|
|
* page poisoning is debug page alloc for some arches. If either
|
|
|
|
* of those options are enabled, enable poisoning
|
|
|
|
*/
|
|
|
|
if (!IS_ENABLED(CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC)) {
|
|
|
|
if (!want_page_poisoning && !debug_pagealloc_enabled())
|
|
|
|
return;
|
|
|
|
} else {
|
|
|
|
if (!want_page_poisoning)
|
|
|
|
return;
|
|
|
|
}
|
2014-12-13 08:55:52 +08:00
|
|
|
|
2016-03-16 05:56:27 +08:00
|
|
|
__page_poisoning_enabled = true;
|
mm/debug-pagealloc: prepare boottime configurable on/off
Until now, debug-pagealloc needs extra flags in struct page, so we need to
recompile whole source code when we decide to use it. This is really
painful, because it takes some time to recompile and sometimes rebuild is
not possible due to third party module depending on struct page. So, we
can't use this good feature in many cases.
Now, we have the page extension feature that allows us to insert extra
flags to outside of struct page. This gets rid of third party module
issue mentioned above. And, this allows us to determine if we need extra
memory for this page extension in boottime. With these property, we can
avoid using debug-pagealloc in boottime with low computational overhead in
the kernel built with CONFIG_DEBUG_PAGEALLOC. This will help our
development process greatly.
This patch is the preparation step to achive above goal. debug-pagealloc
originally uses extra field of struct page, but, after this patch, it will
use field of struct page_ext. Because memory for page_ext is allocated
later than initialization of page allocator in CONFIG_SPARSEMEM, we should
disable debug-pagealloc feature temporarily until initialization of
page_ext. This patch implements this.
Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Dave Hansen <dave@sr71.net>
Cc: Michal Nazarewicz <mina86@mina86.com>
Cc: Jungsoo Son <jungsoo.son@lge.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2014-12-13 08:55:49 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
struct page_ext_operations page_poisoning_ops = {
|
|
|
|
.need = need_page_poisoning,
|
|
|
|
.init = init_page_poisoning,
|
|
|
|
};
|
|
|
|
|
2009-04-01 06:23:17 +08:00
|
|
|
static inline void set_page_poison(struct page *page)
|
|
|
|
{
|
mm/debug-pagealloc: prepare boottime configurable on/off
Until now, debug-pagealloc needs extra flags in struct page, so we need to
recompile whole source code when we decide to use it. This is really
painful, because it takes some time to recompile and sometimes rebuild is
not possible due to third party module depending on struct page. So, we
can't use this good feature in many cases.
Now, we have the page extension feature that allows us to insert extra
flags to outside of struct page. This gets rid of third party module
issue mentioned above. And, this allows us to determine if we need extra
memory for this page extension in boottime. With these property, we can
avoid using debug-pagealloc in boottime with low computational overhead in
the kernel built with CONFIG_DEBUG_PAGEALLOC. This will help our
development process greatly.
This patch is the preparation step to achive above goal. debug-pagealloc
originally uses extra field of struct page, but, after this patch, it will
use field of struct page_ext. Because memory for page_ext is allocated
later than initialization of page allocator in CONFIG_SPARSEMEM, we should
disable debug-pagealloc feature temporarily until initialization of
page_ext. This patch implements this.
Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Dave Hansen <dave@sr71.net>
Cc: Michal Nazarewicz <mina86@mina86.com>
Cc: Jungsoo Son <jungsoo.son@lge.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2014-12-13 08:55:49 +08:00
|
|
|
struct page_ext *page_ext;
|
|
|
|
|
|
|
|
page_ext = lookup_page_ext(page);
|
|
|
|
__set_bit(PAGE_EXT_DEBUG_POISON, &page_ext->flags);
|
2009-04-01 06:23:17 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline void clear_page_poison(struct page *page)
|
|
|
|
{
|
mm/debug-pagealloc: prepare boottime configurable on/off
Until now, debug-pagealloc needs extra flags in struct page, so we need to
recompile whole source code when we decide to use it. This is really
painful, because it takes some time to recompile and sometimes rebuild is
not possible due to third party module depending on struct page. So, we
can't use this good feature in many cases.
Now, we have the page extension feature that allows us to insert extra
flags to outside of struct page. This gets rid of third party module
issue mentioned above. And, this allows us to determine if we need extra
memory for this page extension in boottime. With these property, we can
avoid using debug-pagealloc in boottime with low computational overhead in
the kernel built with CONFIG_DEBUG_PAGEALLOC. This will help our
development process greatly.
This patch is the preparation step to achive above goal. debug-pagealloc
originally uses extra field of struct page, but, after this patch, it will
use field of struct page_ext. Because memory for page_ext is allocated
later than initialization of page allocator in CONFIG_SPARSEMEM, we should
disable debug-pagealloc feature temporarily until initialization of
page_ext. This patch implements this.
Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Dave Hansen <dave@sr71.net>
Cc: Michal Nazarewicz <mina86@mina86.com>
Cc: Jungsoo Son <jungsoo.son@lge.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2014-12-13 08:55:49 +08:00
|
|
|
struct page_ext *page_ext;
|
|
|
|
|
|
|
|
page_ext = lookup_page_ext(page);
|
|
|
|
__clear_bit(PAGE_EXT_DEBUG_POISON, &page_ext->flags);
|
2009-04-01 06:23:17 +08:00
|
|
|
}
|
|
|
|
|
2016-03-16 05:56:30 +08:00
|
|
|
bool page_is_poisoned(struct page *page)
|
2009-04-01 06:23:17 +08:00
|
|
|
{
|
mm/debug-pagealloc: prepare boottime configurable on/off
Until now, debug-pagealloc needs extra flags in struct page, so we need to
recompile whole source code when we decide to use it. This is really
painful, because it takes some time to recompile and sometimes rebuild is
not possible due to third party module depending on struct page. So, we
can't use this good feature in many cases.
Now, we have the page extension feature that allows us to insert extra
flags to outside of struct page. This gets rid of third party module
issue mentioned above. And, this allows us to determine if we need extra
memory for this page extension in boottime. With these property, we can
avoid using debug-pagealloc in boottime with low computational overhead in
the kernel built with CONFIG_DEBUG_PAGEALLOC. This will help our
development process greatly.
This patch is the preparation step to achive above goal. debug-pagealloc
originally uses extra field of struct page, but, after this patch, it will
use field of struct page_ext. Because memory for page_ext is allocated
later than initialization of page allocator in CONFIG_SPARSEMEM, we should
disable debug-pagealloc feature temporarily until initialization of
page_ext. This patch implements this.
Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Dave Hansen <dave@sr71.net>
Cc: Michal Nazarewicz <mina86@mina86.com>
Cc: Jungsoo Son <jungsoo.son@lge.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2014-12-13 08:55:49 +08:00
|
|
|
struct page_ext *page_ext;
|
|
|
|
|
|
|
|
page_ext = lookup_page_ext(page);
|
2016-03-16 05:56:30 +08:00
|
|
|
if (!page_ext)
|
|
|
|
return false;
|
|
|
|
|
mm/debug-pagealloc: prepare boottime configurable on/off
Until now, debug-pagealloc needs extra flags in struct page, so we need to
recompile whole source code when we decide to use it. This is really
painful, because it takes some time to recompile and sometimes rebuild is
not possible due to third party module depending on struct page. So, we
can't use this good feature in many cases.
Now, we have the page extension feature that allows us to insert extra
flags to outside of struct page. This gets rid of third party module
issue mentioned above. And, this allows us to determine if we need extra
memory for this page extension in boottime. With these property, we can
avoid using debug-pagealloc in boottime with low computational overhead in
the kernel built with CONFIG_DEBUG_PAGEALLOC. This will help our
development process greatly.
This patch is the preparation step to achive above goal. debug-pagealloc
originally uses extra field of struct page, but, after this patch, it will
use field of struct page_ext. Because memory for page_ext is allocated
later than initialization of page allocator in CONFIG_SPARSEMEM, we should
disable debug-pagealloc feature temporarily until initialization of
page_ext. This patch implements this.
Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Dave Hansen <dave@sr71.net>
Cc: Michal Nazarewicz <mina86@mina86.com>
Cc: Jungsoo Son <jungsoo.son@lge.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2014-12-13 08:55:49 +08:00
|
|
|
return test_bit(PAGE_EXT_DEBUG_POISON, &page_ext->flags);
|
2009-04-01 06:23:17 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void poison_page(struct page *page)
|
|
|
|
{
|
2011-11-01 08:08:38 +08:00
|
|
|
void *addr = kmap_atomic(page);
|
2009-04-01 06:23:17 +08:00
|
|
|
|
|
|
|
set_page_poison(page);
|
|
|
|
memset(addr, PAGE_POISON, PAGE_SIZE);
|
2011-11-01 08:08:38 +08:00
|
|
|
kunmap_atomic(addr);
|
2009-04-01 06:23:17 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void poison_pages(struct page *page, int n)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < n; i++)
|
|
|
|
poison_page(page + i);
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool single_bit_flip(unsigned char a, unsigned char b)
|
|
|
|
{
|
|
|
|
unsigned char error = a ^ b;
|
|
|
|
|
|
|
|
return error && !(error & (error - 1));
|
|
|
|
}
|
|
|
|
|
|
|
|
static void check_poison_mem(unsigned char *mem, size_t bytes)
|
|
|
|
{
|
2011-11-01 08:08:05 +08:00
|
|
|
static DEFINE_RATELIMIT_STATE(ratelimit, 5 * HZ, 10);
|
2009-04-01 06:23:17 +08:00
|
|
|
unsigned char *start;
|
|
|
|
unsigned char *end;
|
|
|
|
|
2016-03-16 05:56:27 +08:00
|
|
|
if (IS_ENABLED(CONFIG_PAGE_POISONING_NO_SANITY))
|
|
|
|
return;
|
|
|
|
|
2011-11-01 08:08:10 +08:00
|
|
|
start = memchr_inv(mem, PAGE_POISON, bytes);
|
|
|
|
if (!start)
|
2009-04-01 06:23:17 +08:00
|
|
|
return;
|
|
|
|
|
|
|
|
for (end = mem + bytes - 1; end > start; end--) {
|
|
|
|
if (*end != PAGE_POISON)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2011-11-01 08:08:05 +08:00
|
|
|
if (!__ratelimit(&ratelimit))
|
2009-04-01 06:23:17 +08:00
|
|
|
return;
|
|
|
|
else if (start == end && single_bit_flip(*start, PAGE_POISON))
|
2016-03-16 05:56:27 +08:00
|
|
|
pr_err("pagealloc: single bit error\n");
|
2009-04-01 06:23:17 +08:00
|
|
|
else
|
2016-03-16 05:56:27 +08:00
|
|
|
pr_err("pagealloc: memory corruption\n");
|
2009-04-01 06:23:17 +08:00
|
|
|
|
|
|
|
print_hex_dump(KERN_ERR, "", DUMP_PREFIX_ADDRESS, 16, 1, start,
|
|
|
|
end - start + 1, 1);
|
|
|
|
dump_stack();
|
|
|
|
}
|
|
|
|
|
|
|
|
static void unpoison_page(struct page *page)
|
|
|
|
{
|
2011-11-01 08:08:38 +08:00
|
|
|
void *addr;
|
|
|
|
|
2016-03-16 05:56:30 +08:00
|
|
|
if (!page_is_poisoned(page))
|
2009-04-01 06:23:17 +08:00
|
|
|
return;
|
|
|
|
|
2011-11-01 08:08:38 +08:00
|
|
|
addr = kmap_atomic(page);
|
|
|
|
check_poison_mem(addr, PAGE_SIZE);
|
|
|
|
clear_page_poison(page);
|
|
|
|
kunmap_atomic(addr);
|
2009-04-01 06:23:17 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void unpoison_pages(struct page *page, int n)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < n; i++)
|
|
|
|
unpoison_page(page + i);
|
|
|
|
}
|
|
|
|
|
2016-03-16 05:56:27 +08:00
|
|
|
void kernel_poison_pages(struct page *page, int numpages, int enable)
|
2009-04-01 06:23:17 +08:00
|
|
|
{
|
2016-03-16 05:56:27 +08:00
|
|
|
if (!page_poisoning_enabled())
|
mm/debug-pagealloc: prepare boottime configurable on/off
Until now, debug-pagealloc needs extra flags in struct page, so we need to
recompile whole source code when we decide to use it. This is really
painful, because it takes some time to recompile and sometimes rebuild is
not possible due to third party module depending on struct page. So, we
can't use this good feature in many cases.
Now, we have the page extension feature that allows us to insert extra
flags to outside of struct page. This gets rid of third party module
issue mentioned above. And, this allows us to determine if we need extra
memory for this page extension in boottime. With these property, we can
avoid using debug-pagealloc in boottime with low computational overhead in
the kernel built with CONFIG_DEBUG_PAGEALLOC. This will help our
development process greatly.
This patch is the preparation step to achive above goal. debug-pagealloc
originally uses extra field of struct page, but, after this patch, it will
use field of struct page_ext. Because memory for page_ext is allocated
later than initialization of page allocator in CONFIG_SPARSEMEM, we should
disable debug-pagealloc feature temporarily until initialization of
page_ext. This patch implements this.
Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Dave Hansen <dave@sr71.net>
Cc: Michal Nazarewicz <mina86@mina86.com>
Cc: Jungsoo Son <jungsoo.son@lge.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2014-12-13 08:55:49 +08:00
|
|
|
return;
|
|
|
|
|
2009-04-01 06:23:17 +08:00
|
|
|
if (enable)
|
|
|
|
unpoison_pages(page, numpages);
|
|
|
|
else
|
|
|
|
poison_pages(page, numpages);
|
|
|
|
}
|
2016-03-16 05:56:27 +08:00
|
|
|
|
|
|
|
#ifndef CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC
|
|
|
|
void __kernel_map_pages(struct page *page, int numpages, int enable)
|
|
|
|
{
|
|
|
|
/* This function does nothing, all work is done via poison pages */
|
|
|
|
}
|
|
|
|
#endif
|