Bug 1311 - reduce size of minimal ACPI config
Summary: reduce size of minimal ACPI config
Status: CLOSED CODE_FIX
Alias: None
Product: ACPI
Classification: Unclassified
Component: Config-Tables (show other bugs)
Hardware: i386 Linux
: P2 normal
Assignee: Len Brown
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-10-02 20:21 UTC by Len Brown
Modified: 2006-02-02 14:27 UTC (History)
1 user (show)

See Also:
Kernel Version: 2.4.22-pre6
Subsystem:
Regression: ---
Bisected commit-id:


Attachments
patch to add __initdata to sdt_entry[] (709 bytes, patch)
2005-12-29 23:18 UTC, Len Brown
Details | Diff
script to output static ACPI object size (836 bytes, text/plain)
2005-12-29 23:43 UTC, Len Brown
Details

Description Len Brown 2003-10-02 20:21:50 UTC
since we made CONFIG_ACPI_BOOT default for most interesting configurations, 
the size of ACPI has come under scrutiny. 
 
One offender is this: 
 
+static struct acpi_table_sdt   sdt_entry[ACPI_MAX_TABLES]; 
It should be __initdata, and ACPI_MAX_TABLES's value should be confirmed.
Comment 1 Len Brown 2005-12-29 23:18:50 UTC
Created attachment 6902 [details]
patch to add __initdata to sdt_entry[]

All the routines that touch this static array are __init,
so it is safe to use __initdata.

__initdata here moves about 5KB from .bss to .init.data
eg.
< Freeing unused kernel memory: 216k freed
---
> Freeing unused kernel memory: 220k freed				       
									

before: size -A drivers/acpi/tables.o
rivers/acpi/tables.o  :
section 	  size	 addr
.text		   676	    0
.data		   224	    0
.bss		  5136	    0
.rodata.str1.1	  1611	    0
.rodata 	    72	    0
.init.text	  1618	    0
.comment	    53	    0
.note.GNU-stack      0	    0
Total		  9390

after: size -A drivers/acpi/tables.o
drivers/acpi/tables.o  :
section 	  size	 addr
.text		   676	    0
.data		   224	    0
.bss		    16	    0
.rodata.str1.1	  1611	    0
.rodata 	    72	    0
.init.text	  1618	    0
.init.data	  5120	    0
.comment	    53	    0
.note.GNU-stack      0	    0
Total		  9390

While we're at it, lets reduce ACPI_MAX_TABLES to 128 from 256.
I polled folks a while back and nobody complained about 64,
so 128 should be fine.
Comment 2 Len Brown 2005-12-29 23:19:55 UTC
applied patch in comment #2 to acpi-test
Comment 3 Len Brown 2005-12-29 23:30:53 UTC
size -A drivers/acpi/tables.o with ACPI_MAX_TABLES 128:

section           size   addr
.text              676      0
.data              224      0
.bss                16      0
.rodata.str1.1    1611      0
.rodata             72      0
.init.text        1612      0
.init.data        2560      0
.comment            53      0
.note.GNU-stack      0      0
Total             6824
Comment 4 Len Brown 2005-12-29 23:43:40 UTC
Created attachment 6903 [details]
script to output static ACPI object size

Attached is a script to show ACPI kernel object static size.
It shows that ACPI doubles in size when CONIFG_ACPI_DEBUG=y is used:

CONFIG_ACPI_DEBUG=y

ACPI x86_64 specific files:
   8349     472      40    8861    229d arch/x86_64/kernel/acpi/built-in.o
ACPICA Core files:
 245234    4320    1012  250566   3d2c6 (TOTALS)
  51859     184       0   52043    cb4b drivers/acpi/executer/built-in.o
  36760     192       0   36952    9058 drivers/acpi/dispatcher/built-in.o
  31524    2120     992   34636    874c drivers/acpi/utilities/built-in.o
  28860     200       0   29060    7184 drivers/acpi/events/built-in.o
  28903     112       0   29015    7157 drivers/acpi/namespace/built-in.o
  18026      80       0   18106    46ba drivers/acpi/resources/built-in.o
  16758      64       4   16826    41ba drivers/acpi/tables/built-in.o
  16525      72       4   16601    40d9 drivers/acpi/parser/built-in.o
  10189      32       0   10221    27ed drivers/acpi/hardware/built-in.o
   5830    1264      12    7106    1bc2 drivers/acpi/sleep/built-in.o
Linux specific files:
 209221   29941    2500  241662   3affe (TOTALS)
  25734    1768     200   27702    6c36 drivers/acpi/processor.o
  16085    3216     676   19977    4e09 drivers/acpi/ibm_acpi.o
  15438    2440       8   17886    45de drivers/acpi/video.o
  12837    1448      12   14297    37d9 drivers/acpi/thermal.o
  11591     634      24   12249    2fd9 drivers/acpi/ec.o
   8231    2624      32   10887    2a87 drivers/acpi/asus_acpi.o
   8781    1400      72   10253    280d drivers/acpi/hotkey.o
   7337    1847      40    9224    2408 drivers/acpi/pci_link.o
   7614     968       8    8590    218e drivers/acpi/battery.o
   7908     520     128    8556    216c drivers/acpi/processor_core.o
   8041     392       0    8433    20f1 drivers/acpi/scan.o
   7360     304     288    7952    1f10 drivers/acpi/bus.o
   6912     664      24    7600    1db0 drivers/acpi/processor_idle.o
   6119     232     676    7027    1b73 drivers/acpi/osl.o
   3971    2784      16    6771    1a73 drivers/acpi/tables.o
   6144     512      32    6688    1a20 drivers/acpi/power.o
   4993      88       8    5089    13e1 drivers/acpi/processor_perflib.o
   4818      44      24    4886    1316 drivers/acpi/pci_irq.o
   3815     744      32    4591    11ef drivers/acpi/button.o
   4345       8       0    4353    1101 drivers/acpi/utils.o
   3495       8       0    3503     daf drivers/acpi/pci_bind.o
   3246     144      32    3422     d5e drivers/acpi/toshiba_acpi.o
   3061     248      32    3341     d0d drivers/acpi/processor_thermal.o
   2589     520       8    3117     c2d drivers/acpi/ac.o
   2746     224       0    2970     b9a drivers/acpi/processor_throttling.o
   2892      48       0    2940     b7c drivers/acpi/debug.o
   2079     520       8    2607     a2f drivers/acpi/fan.o
   2286     312       8    2606     a2e drivers/acpi/pci_root.o
   2016     304       0    2320     910 drivers/acpi/container.o
   1953      88       0    2041     7f9 drivers/acpi/glue.o
   1109     680       0    1789     6fd drivers/acpi/system.o
   1041     584       0    1625     659 drivers/acpi/motherboard.o
    860     256     112    1228     4cc drivers/acpi/event.o
    106    1024       0    1130     46a drivers/acpi/toshiba_acpi.mod.o
    106    1024       0    1130     46a drivers/acpi/hotkey.mod.o
    106    1024       0    1130     46a drivers/acpi/asus_acpi.mod.o
    873       8       0     881     371 drivers/acpi/numa.o
    583     288       0     871     367 drivers/acpi/blacklist.o
Total ACPI static and modules sizes:
 437862   33240    3476  474578   73dd2 (TOTALS)
 408859   25528    3300  437687   6adb7 drivers/acpi/built-in.o
   8365    3648      32   12045    2f0d drivers/acpi/asus_acpi.ko
   8910    2424      72   11406    2c8e drivers/acpi/hotkey.ko
   8349     472      40    8861    229d arch/x86_64/kernel/acpi/built-in.o
   3379    1168      32    4579    11e3 drivers/acpi/toshiba_acpi.ko

CONFIG_ACPI_DEBUG=n:

ACPI x86_64 specific files:
   8349     472      40    8861    229d arch/x86_64/kernel/acpi/built-in.o
ACPICA Core files:
 114901    3188     948  119037   1d0fd (TOTALS)
  22838       0       0   22838    5936 drivers/acpi/executer/built-in.o
  14250    1832     928   17010    4272 drivers/acpi/utilities/built-in.o
  14622      96       0   14718    397e drivers/acpi/dispatcher/built-in.o
  13368       4       0   13372    343c drivers/acpi/events/built-in.o
  11373       0       0   11373    2c6d drivers/acpi/namespace/built-in.o
   9720       0       0    9720    25f8 drivers/acpi/resources/built-in.o
   9418       0       4    9422    24ce drivers/acpi/parser/built-in.o
   8693       0       4    8697    21f9 drivers/acpi/tables/built-in.o
   5338    1256      12    6606    19ce drivers/acpi/sleep/built-in.o
   5281       0       0    5281    14a1 drivers/acpi/hardware/built-in.o
Linux specific files:
 119311   29733    2500  151544   24ff8 (TOTALS)
  16085    3216     676   19977    4e09 drivers/acpi/ibm_acpi.o
  11583    1752     200   13535    34df drivers/acpi/processor.o
   8231    2624      32   10887    2a87 drivers/acpi/asus_acpi.o
   7748    2440       8   10196    27d4 drivers/acpi/video.o
   7584     602      24    8210    2012 drivers/acpi/ec.o
   6136    1448      12    7596    1dac drivers/acpi/thermal.o
   3971    2784      16    6771    1a73 drivers/acpi/tables.o
   5257    1400      72    6729    1a49 drivers/acpi/hotkey.o
   5350     392       0    5742    166e drivers/acpi/scan.o
   4338     968       8    5314    14c2 drivers/acpi/battery.o
   4106     224     676    5006    138e drivers/acpi/osl.o
   3062    1847      40    4949    1355 drivers/acpi/pci_link.o
   4240     664      24    4928    1340 drivers/acpi/processor_idle.o
   3217     520     128    3865     f19 drivers/acpi/processor_core.o
   3022     288     288    3598     e0e drivers/acpi/bus.o
   3246     144      32    3422     d5e drivers/acpi/toshiba_acpi.o
   2291     512      32    2835     b13 drivers/acpi/power.o
   2017     744      32    2793     ae9 drivers/acpi/button.o
   2282      28      24    2334     91e drivers/acpi/pci_irq.o
   1953      88       0    2041     7f9 drivers/acpi/glue.o
   1895      72       8    1975     7b7 drivers/acpi/processor_perflib.o
   1060     520       8    1588     634 drivers/acpi/ac.o
   1222     312       8    1542     606 drivers/acpi/pci_root.o
   1213     248      32    1493     5d5 drivers/acpi/processor_thermal.o
    929     520       8    1457     5b1 drivers/acpi/fan.o
   1030     296       0    1326     52e drivers/acpi/container.o
    741     576       0    1317     525 drivers/acpi/motherboard.o
   1279       0       0    1279     4ff drivers/acpi/pci_bind.o
    513     672       0    1185     4a1 drivers/acpi/system.o
    964     216       0    1180     49c drivers/acpi/processor_throttling.o
    106    1024       0    1130     46a drivers/acpi/toshiba_acpi.mod.o
    106    1024       0    1130     46a drivers/acpi/hotkey.mod.o
    106    1024       0    1130     46a drivers/acpi/asus_acpi.mod.o
    959       0       0     959     3bf drivers/acpi/utils.o
    583     288       0     871     367 drivers/acpi/blacklist.o
    464     256     112     832     340 drivers/acpi/event.o
    422       0       0     422     1a6 drivers/acpi/numa.o
Total ACPI static and modules sizes:
 231377   31944    3412  266733   411ed (TOTALS)
 205899   24232    3236  233367   38f97 drivers/acpi/built-in.o
   8365    3648      32   12045    2f0d drivers/acpi/asus_acpi.ko
   8349     472      40    8861    229d arch/x86_64/kernel/acpi/built-in.o
   5385    2424      72    7881    1ec9 drivers/acpi/hotkey.ko
   3379    1168      32    4579    11e3 drivers/acpi/toshiba_acpi.ko
Comment 5 Len Brown 2006-02-02 14:27:30 UTC
Shipped in 2.6.16-rc1-git6 -- closing.

Note You need to log in before you can comment on or make changes to this bug.