Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit db56ca3

Browse files
Sai Harshini Nimmalatoddkjos
authored andcommitted
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 <[email protected]> Change-Id: Iebc422ba4c650864f470078220b99546e56302f3
1 parent 26f2a1b commit db56ca3

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

init/Kconfig.gki

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,21 @@ config GKI_HIDDEN_DMA_CONFIGS
246246
Dummy config option used to enable the hidden DMA configs,
247247
required by various SoC platforms.
248248

249+
config GKI_DYNAMIC_TASK_STRUCT_SIZE
250+
bool "Dynamic task_struct size needed for GKI"
251+
select ARCH_WANTS_DYNAMIC_TASK_STRUCT
252+
help
253+
Avoid static allocation of memory for vendor data in task_struct.
254+
255+
config GKI_TASK_STRUCT_VENDOR_SIZE_MAX
256+
int "Max vendor data size in bytes"
257+
default 512
258+
depends on GKI_DYNAMIC_TASK_STRUCT_SIZE
259+
help
260+
Allows vendor to choose the maximum size which can be added to
261+
task_struct dynamically when the GKI_DYNAMIC_TASK_STRUCT_SIZE
262+
option is enabled.
263+
249264
# Atrocities needed for
250265
# a) building GKI modules in separate tree, or
251266
# b) building drivers that are not modularizable
@@ -279,6 +294,7 @@ config GKI_HACKS_TO_FIX
279294
select GKI_HIDDEN_MM_CONFIGS
280295
select GKI_HIDDEN_ETHERNET_CONFIGS
281296
select GKI_HIDDEN_DMA_CONFIGS
297+
select GKI_DYNAMIC_TASK_STRUCT_SIZE
282298

283299
help
284300
Dummy config option used to enable core functionality used by

init/main.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -899,6 +899,13 @@ static void __init early_numa_node_init(void)
899899
#endif
900900
}
901901

902+
#ifdef CONFIG_ARCH_WANTS_DYNAMIC_TASK_STRUCT
903+
static void __init setup_arch_task_struct_size(void)
904+
{
905+
arch_task_struct_size = sizeof(struct task_struct);
906+
}
907+
#endif
908+
902909
asmlinkage __visible __init __no_sanitize_address __noreturn __no_stack_protector
903910
void start_kernel(void)
904911
{
@@ -922,6 +929,9 @@ void start_kernel(void)
922929
boot_cpu_init();
923930
page_address_init();
924931
pr_notice("%s", linux_banner);
932+
#ifdef CONFIG_ARCH_WANTS_DYNAMIC_TASK_STRUCT
933+
setup_arch_task_struct_size();
934+
#endif
925935
setup_arch(&command_line);
926936
/* Static keys and static calls are needed by LSMs */
927937
jump_label_init();

0 commit comments

Comments
 (0)