arm64: Dereference CPU operations indirectly
v2 cover arm64: Dereference CPU operations indirectly
In current implementation, an array (@cpu_ops[NR_CPUS]) is maintained to dereference the CPU operations. 2KB memory are consumed when NR_CPUS is configured to 256. It's too much than what I expected. This series reworks the implementation to dereference the CPU operations indirectly, so that less memory (64 bytes) will be consumed for the same purpose. The optimization bases on the assumption: these CPU operations aren't dereferenced in hot path.
PATCH[1/4] isn't too much relevant, to declare ACPI parking protocol only when CONFIG_ARM64_ACPI_PARKING_PROTOCOL has been enabled. PATCH[2/4] renames cpu_read_ops() to init_cpu_ops(), which is obviously more precise because it's initializing the CPU operations. PATCH[3/4] introduces get_cpu_ops(), preparing for dereferencing CPU operations indirectly. PATCH[4/4] makes dereferencing CPU operations indirectly happen.
Changelog
=========
v2:
* Pack 4 CPUs' indexes into one byte. 64 bytes are consumed in order
to get the CPU operations (Robin Murphy) * Use ARRAY_SIZE() to iterate @cpu_ops[] (Robin Murphy) * Make index-0 valid (Robin Murphy)
Gavin Shan (4):
arm64: Declare ACPI parking protocol CPU operation if needed
arm64: Rename cpu_read_ops() to init_cpu_ops()
arm64: Introduce get_cpu_ops() helper function
arm64: Dereference CPU operations indirectly
arch/arm64/include/asm/cpu_ops.h | 8 ++--- arch/arm64/kernel/cpu_ops.c | 56 ++++++++++++++++-------------- arch/arm64/kernel/cpuidle.c | 9 ++--- arch/arm64/kernel/setup.c | 8 +++-- arch/arm64/kernel/smp.c | 59 ++++++++++++++++++++++---------- 5 files changed, 85 insertions(+), 55 deletions(-)
Signature · 7 lines
2.23.0 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Quoted 15 lines · Gavin Shan
In current implementation, an array (@cpu_ops[NR_CPUS]) is maintained to dereference the CPU operations. 2KB memory are consumed when
NR_CPUSis configured to 256. It's too much than what I expected. This series reworks the implementation to dereference the CPU operations indirectly, so that less memory (64 bytes) will be consumed for the same purpose. The optimization bases on the assumption: these CPU operations aren't dereferenced in hot path.PATCH[1/4] isn't too much relevant, to declare ACPI parking protocol only when
CONFIG_ARM64_ACPI_PARKING_PROTOCOLhas been enabled. PATCH[2/4] renamescpu_read_ops()toinit_cpu_ops(), which is obviously more precise because it's initializing the CPU operations. PATCH[3/4] introducesget_cpu_ops(), preparing for dereferencing CPU operations indirectly. PATCH[4/4] makes dereferencing CPU operations indirectly happen.
Quoted 8 lines
Changelog
=========
v2:
* Pack 4 CPUs' indexes into one byte. 64 bytes are consumed in order
to get the CPU operations (Robin Murphy)
* UseARRAY_SIZE()to iterate @cpu_ops[] (Robin Murphy)
* Make index-0 valid (Robin Murphy)
Robin, Please let me know if you have more comments on this series, thanks!
Thanks,
Gavin
Quoted 6 lines
Gavin Shan (4):
arm64: Declare ACPI parking protocol CPU operation if needed
arm64: Renamecpu_read_ops()toinit_cpu_ops()
arm64: Introduceget_cpu_ops()helper function
arm64: Dereference CPU operations indirectly
Quoted 7 lines
arch/arm64/include/asm/cpu_ops.h | 8 ++--- arch/arm64/kernel/cpu_ops.c | 56 ++++++++++++++++-------------- arch/arm64/kernel/cpuidle.c | 9 ++--- arch/arm64/kernel/setup.c | 8 +++-- arch/arm64/kernel/smp.c | 59 ++++++++++++++++++++++---------- 5 files changed, 85 insertions(+), 55 deletions(-)
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel