ANDROID: GKI: Enable the option to alter task_struct size dynamically

Enable the config option that allows for dynamic sizing of the
task_struct. Once config option is enabled, ensure that
arch_task_struct_size is initialized to hold a valid task_struct size.
The motivation behind this change is to reduce the static memory added to
the task_struct to accommodate vendor data.

Bug: 233921394
Signed-off-by: Sai Harshini Nimmala <quic_snimmala@quicinc.com>
Change-Id: Iebc422ba4c650864f470078220b99546e56302f3
This commit is contained in:
Sai Harshini Nimmala
2024-10-03 14:02:50 -07:00
committed by Todd Kjos
parent 26f2a1b422
commit db56ca3b78
2 changed files with 26 additions and 0 deletions
+16
View File
@@ -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
+10
View File
@@ -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();