diff --git a/init/Kconfig.gki b/init/Kconfig.gki index 63246c7a5000..f6ec49f17376 100644 --- a/init/Kconfig.gki +++ b/init/Kconfig.gki @@ -246,6 +246,21 @@ config GKI_HIDDEN_DMA_CONFIGS Dummy config option used to enable the hidden DMA configs, required by various SoC platforms. +config GKI_DYNAMIC_TASK_STRUCT_SIZE + bool "Dynamic task_struct size needed for GKI" + select ARCH_WANTS_DYNAMIC_TASK_STRUCT + help + Avoid static allocation of memory for vendor data in task_struct. + +config GKI_TASK_STRUCT_VENDOR_SIZE_MAX + int "Max vendor data size in bytes" + default 512 + depends on GKI_DYNAMIC_TASK_STRUCT_SIZE + help + Allows vendor to choose the maximum size which can be added to + task_struct dynamically when the GKI_DYNAMIC_TASK_STRUCT_SIZE + option is enabled. + # Atrocities needed for # a) building GKI modules in separate tree, or # b) building drivers that are not modularizable @@ -279,6 +294,7 @@ config GKI_HACKS_TO_FIX select GKI_HIDDEN_MM_CONFIGS select GKI_HIDDEN_ETHERNET_CONFIGS select GKI_HIDDEN_DMA_CONFIGS + select GKI_DYNAMIC_TASK_STRUCT_SIZE help Dummy config option used to enable core functionality used by diff --git a/init/main.c b/init/main.c index c4778edae797..c4bc168fb11f 100644 --- a/init/main.c +++ b/init/main.c @@ -899,6 +899,13 @@ static void __init early_numa_node_init(void) #endif } +#ifdef CONFIG_ARCH_WANTS_DYNAMIC_TASK_STRUCT +static void __init setup_arch_task_struct_size(void) +{ + arch_task_struct_size = sizeof(struct task_struct); +} +#endif + asmlinkage __visible __init __no_sanitize_address __noreturn __no_stack_protector void start_kernel(void) { @@ -922,6 +929,9 @@ void start_kernel(void) boot_cpu_init(); page_address_init(); pr_notice("%s", linux_banner); +#ifdef CONFIG_ARCH_WANTS_DYNAMIC_TASK_STRUCT + setup_arch_task_struct_size(); +#endif setup_arch(&command_line); /* Static keys and static calls are needed by LSMs */ jump_label_init();