All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/4] arm64: Dereference CPU operations indirectly
@ 2020-02-03 23:51 Gavin Shan
  2020-02-11  1:47 ` Gavin Shan
  0 siblings, 1 reply; 2+ messages in thread
From: Gavin Shan @ 2020-02-03 23:51 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: mark.rutland, lorenzo.pieralisi, catalin.marinas, robin.murphy,
	sudeep.holla, will

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(-)

-- 
2.23.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH v2 0/4] arm64: Dereference CPU operations indirectly
  2020-02-03 23:51 [PATCH v2 0/4] arm64: Dereference CPU operations indirectly Gavin Shan
@ 2020-02-11  1:47 ` Gavin Shan
  0 siblings, 0 replies; 2+ messages in thread
From: Gavin Shan @ 2020-02-11  1:47 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: mark.rutland, lorenzo.pieralisi, will, catalin.marinas,
	sudeep.holla, robin.murphy

On 2/4/20 10:51 AM, Gavin Shan wrote:
> 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)
> 

Robin, Please let me know if you have more comments on this series, thanks!

Thanks,
Gavin

> 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(-)
> 


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-02-11  1:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-03 23:51 [PATCH v2 0/4] arm64: Dereference CPU operations indirectly Gavin Shan
2020-02-11  1:47 ` Gavin Shan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.