All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 1/1] ACPI: bus: Reduce runtime memory footprint of struct acpi_device
@ 2026-09-09 16:39 Andy Shevchenko
  2026-09-10 17:28 ` Rafael J. Wysocki (Intel)
  0 siblings, 1 reply; 2+ messages in thread
From: Andy Shevchenko @ 2026-09-09 16:39 UTC (permalink / raw)
  To: Rafael J. Wysocki, linux-acpi, acpica-devel, linux-kernel
  Cc: Rafael J. Wysocki, Maciej Wieczor-Retman, Pawel Chmielewski,
	Len Brown, Andy Shevchenko

The ACPI handler is heavily used by the ACPI code. Making it as
the first member in the struct acpi_device reduces code size.
For instance, the drivers/acpi/scan.o (with `make allyesconfig`)
gives this statistics:

add/remove: 0/0 grow/shrink: 3/8 up/down: 50/-169 (-119)
Function                                     old     new   delta
acpi_device_add                             2294    2319     +25
acpi_add_single_object                      6523    6544     +21
acpi_dev_get_next_consumer_dev               602     606      +4
acpi_tie_acpi_dev                            169     165      -4
acpi_scan_drop_device                        319     315      -4
acpi_dev_clear_dependencies                 1151    1147      -4
acpi_bus_attach                             2898    2894      -4
acpi_dma_get_range                          1420    1415      -5
acpi_init_device_object                     5497    5485     -12
acpi_bus_check_add                          1940    1923     -17
acpi_device_hotplug                         3407    3288    -119
Total: Before=77509, After=77390, chg -0.15%

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 include/acpi/acpi_bus.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index a10a591c18b2..64ae66ca456e 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -435,9 +435,9 @@ struct acpi_device_software_nodes {
 
 /* Device */
 struct acpi_device {
+	acpi_handle handle;		/* no handle for fixed hardware */
 	u32 pld_crc;
 	int device_type;
-	acpi_handle handle;		/* no handle for fixed hardware */
 	struct fwnode_handle fwnode;
 	struct list_head wakeup_list;
 	struct list_head del_list;
-- 
2.50.1


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

* Re: [PATCH v1 1/1] ACPI: bus: Reduce runtime memory footprint of struct acpi_device
  2026-09-09 16:39 [PATCH v1 1/1] ACPI: bus: Reduce runtime memory footprint of struct acpi_device Andy Shevchenko
@ 2026-09-10 17:28 ` Rafael J. Wysocki (Intel)
  0 siblings, 0 replies; 2+ messages in thread
From: Rafael J. Wysocki (Intel) @ 2026-09-10 17:28 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Rafael J. Wysocki, linux-acpi, acpica-devel, linux-kernel,
	Rafael J. Wysocki, Maciej Wieczor-Retman, Pawel Chmielewski,
	Len Brown

On Wed, Sep 9, 2026 at 6:39 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> The ACPI handler is heavily used by the ACPI code. Making it as
> the first member in the struct acpi_device reduces code size.
> For instance, the drivers/acpi/scan.o (with `make allyesconfig`)
> gives this statistics:
>
> add/remove: 0/0 grow/shrink: 3/8 up/down: 50/-169 (-119)
> Function                                     old     new   delta
> acpi_device_add                             2294    2319     +25
> acpi_add_single_object                      6523    6544     +21
> acpi_dev_get_next_consumer_dev               602     606      +4
> acpi_tie_acpi_dev                            169     165      -4
> acpi_scan_drop_device                        319     315      -4
> acpi_dev_clear_dependencies                 1151    1147      -4
> acpi_bus_attach                             2898    2894      -4
> acpi_dma_get_range                          1420    1415      -5
> acpi_init_device_object                     5497    5485     -12
> acpi_bus_check_add                          1940    1923     -17
> acpi_device_hotplug                         3407    3288    -119
> Total: Before=77509, After=77390, chg -0.15%
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  include/acpi/acpi_bus.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
> index a10a591c18b2..64ae66ca456e 100644
> --- a/include/acpi/acpi_bus.h
> +++ b/include/acpi/acpi_bus.h
> @@ -435,9 +435,9 @@ struct acpi_device_software_nodes {
>
>  /* Device */
>  struct acpi_device {
> +       acpi_handle handle;             /* no handle for fixed hardware */
>         u32 pld_crc;
>         int device_type;
> -       acpi_handle handle;             /* no handle for fixed hardware */
>         struct fwnode_handle fwnode;
>         struct list_head wakeup_list;
>         struct list_head del_list;
> --

Applied as 7.4 material, thanks!

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

end of thread, other threads:[~2026-09-10 17:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-09 16:39 [PATCH v1 1/1] ACPI: bus: Reduce runtime memory footprint of struct acpi_device Andy Shevchenko
2026-09-10 17:28 ` Rafael J. Wysocki (Intel)

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.