ANDROID: 16K: Init page_shift param in a pure_initcall()
Previously, page_shift_compat_enabled was initialized in the early_param() function for page_shift. However, if page_shift is passed as a bootconfig, page_shift_compat_enabled is not initialized because it is too late. In order to initialized page_shift_compat_enabled when page_shift is passed as a kernel command line or bootconfig parameter, a pure_initcall() will be used. Bug: 376901009 Test: atest Vts16KPageSizeTest Change-Id: I8127566062c5e0177636f2164a29801a0579ac51 Signed-off-by: Juan Yescas <jyescas@google.com>
This commit is contained in:
committed by
Carlos Llamas
parent
68ba0f4dfb
commit
44a6882cc7
+21
-3
@@ -10,6 +10,7 @@
|
|||||||
#include <linux/init.h>
|
#include <linux/init.h>
|
||||||
#include <linux/kstrtox.h>
|
#include <linux/kstrtox.h>
|
||||||
#include <linux/mm.h>
|
#include <linux/mm.h>
|
||||||
|
#include <linux/moduleparam.h>
|
||||||
#include <linux/pagemap.h>
|
#include <linux/pagemap.h>
|
||||||
#include <linux/page_size_compat.h>
|
#include <linux/page_size_compat.h>
|
||||||
#include <linux/swap.h>
|
#include <linux/swap.h>
|
||||||
@@ -25,11 +26,15 @@ EXPORT_SYMBOL_GPL(page_shift_compat_enabled);
|
|||||||
int page_shift_compat __ro_after_init = MIN_PAGE_SHIFT_COMPAT;
|
int page_shift_compat __ro_after_init = MIN_PAGE_SHIFT_COMPAT;
|
||||||
EXPORT_SYMBOL_GPL(page_shift_compat);
|
EXPORT_SYMBOL_GPL(page_shift_compat);
|
||||||
|
|
||||||
static int __init early_page_shift_compat(char *buf)
|
static int __init page_shift_params(char *param, char *val,
|
||||||
|
const char *unused, void *arg)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = kstrtoint(buf, 10, &page_shift_compat);
|
if (strcmp(param, "page_shift") != 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
ret = kstrtoint(val, 10, &page_shift_compat);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
@@ -45,7 +50,20 @@ static int __init early_page_shift_compat(char *buf)
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
early_param("page_shift", early_page_shift_compat);
|
|
||||||
|
static int __init init_page_shift_compat(void)
|
||||||
|
{
|
||||||
|
char *err;
|
||||||
|
|
||||||
|
err = parse_args("page_shift", saved_command_line, NULL, 0, 0, 0, NULL,
|
||||||
|
page_shift_params);
|
||||||
|
|
||||||
|
if (IS_ERR(err))
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
pure_initcall(init_page_shift_compat);
|
||||||
|
|
||||||
static int __init init_mmap_rnd_bits(void)
|
static int __init init_mmap_rnd_bits(void)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user