提交 baeaf1da 编写于 作者: P Peng Liu 提交者: Yang Yingliang

mm/page_alloc: Use cmdline to disable "place pages to tail"

hulk inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I4EG0R
CVE: NA

-----------------------------------------------

Add cmdline to disable "place pages to tail" when online memory.
Signed-off-by: NPeng Liu <liupeng256@huawei.com>
Reviewed-by: NKefeng Wang <wangkefeng.wang@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 b42b7eb0
...@@ -1254,6 +1254,15 @@ ...@@ -1254,6 +1254,15 @@
Warning: use of this parameter will taint the kernel Warning: use of this parameter will taint the kernel
and may cause unknown problems. and may cause unknown problems.
fpi_to_tail=off
[KNL] Place pages to front in __free_pages_core().
This kernel start-up parameter can be just used as
"fpi_to_tail=off", which means memory is online to
the front of freelist. Dynamic open is not supportted,
in other words, "fpi_to_tail=on" will be ignored by
kernel. This is just an ugly solution for circumvention
for some latent bugs revealed by "place pages to tail".
ftrace=[tracer] ftrace=[tracer]
[FTRACE] will set and start the specified tracer [FTRACE] will set and start the specified tracer
as early as possible in order to facilitate early as early as possible in order to facilitate early
......
...@@ -102,6 +102,17 @@ typedef int __bitwise fpi_t; ...@@ -102,6 +102,17 @@ typedef int __bitwise fpi_t;
*/ */
#define FPI_TO_TAIL ((__force fpi_t)BIT(1)) #define FPI_TO_TAIL ((__force fpi_t)BIT(1))
static bool fpi_to_tail = true;
static int __init early_fpi_to_tail(char *str)
{
if (str && !strcmp(str, "off"))
fpi_to_tail = false;
return 0;
}
early_param("fpi_to_tail", early_fpi_to_tail);
/* prevent >1 _updater_ of zone percpu pageset ->high and ->batch fields */ /* prevent >1 _updater_ of zone percpu pageset ->high and ->batch fields */
static DEFINE_MUTEX(pcp_batch_high_lock); static DEFINE_MUTEX(pcp_batch_high_lock);
#define MIN_PERCPU_PAGELIST_FRACTION (8) #define MIN_PERCPU_PAGELIST_FRACTION (8)
...@@ -1342,12 +1353,16 @@ void __free_pages_core(struct page *page, unsigned int order) ...@@ -1342,12 +1353,16 @@ void __free_pages_core(struct page *page, unsigned int order)
} }
__ClearPageReserved(p); __ClearPageReserved(p);
set_page_count(p, 0); set_page_count(p, 0);
if (fpi_to_tail) {
/* /*
* Bypass PCP and place fresh pages right to the tail, primarily * Bypass PCP and place fresh pages right to the tail, primarily
* relevant for memory onlining. * relevant for memory onlining.
*/ */
__free_pages_ok(page, order, FPI_TO_TAIL); __free_pages_ok(page, order, FPI_TO_TAIL);
} else {
set_page_refcounted(page);
__free_pages(page, order);
}
} }
#if defined(CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID) || \ #if defined(CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID) || \
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册