diff mbox series

[06/28] ata: use COMMAND_LINE_SIZE for ata_force_param_buf[] size

Message ID 20200128133343.29905-7-b.zolnierkie@samsung.com
State Not Applicable
Delegated to: David Miller
Headers show
Series ata: optimize core code size on PATA only setups | expand

Commit Message

Bartlomiej Zolnierkiewicz Jan. 28, 2020, 1:33 p.m. UTC
Use COMMAND_LINE_SIZE instead PAGE_SIZE for ata_force_param_buf[]
size as libata parameters buffer doesn't need to be bigger than
the command line buffer.

For many architectures this results in decreased libata-core.o
size (COMMAND_LINE_SIZE varies from 256 to 4096 while the minimum
PAGE_SIZE is 4096).

Code size savings on m68k arch using atari_defconfig:

   text    data     bss     dec     hex filename
before:
  41064    4413      40   45517    b1cd drivers/ata/libata-core.o
after:
  41064     573      40   41677    a2cd drivers/ata/libata-core.o

Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
---
 drivers/ata/libata-core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Christoph Hellwig Jan. 29, 2020, 5:18 p.m. UTC | #1
On Tue, Jan 28, 2020 at 02:33:21PM +0100, Bartlomiej Zolnierkiewicz wrote:
> Use COMMAND_LINE_SIZE instead PAGE_SIZE for ata_force_param_buf[]
> size as libata parameters buffer doesn't need to be bigger than
> the command line buffer.
> 
> For many architectures this results in decreased libata-core.o
> size (COMMAND_LINE_SIZE varies from 256 to 4096 while the minimum
> PAGE_SIZE is 4096).
> 
> Code size savings on m68k arch using atari_defconfig:
> 
>    text    data     bss     dec     hex filename
> before:
>   41064    4413      40   45517    b1cd drivers/ata/libata-core.o
> after:
>   41064     573      40   41677    a2cd drivers/ata/libata-core.o
> 
> Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>

This looks like a good start, so:

Reviewed-by: Christoph Hellwig <hch@lst.de>

But evne COMMAND_LINE_SIZE is quite a lot of overhead.  Can we maybe add
a new Kconfig option to optionally disable the libata.force= entirely?
Bartlomiej Zolnierkiewicz Feb. 7, 2020, 2:17 p.m. UTC | #2
On 1/29/20 6:18 PM, Christoph Hellwig wrote:
> On Tue, Jan 28, 2020 at 02:33:21PM +0100, Bartlomiej Zolnierkiewicz wrote:
>> Use COMMAND_LINE_SIZE instead PAGE_SIZE for ata_force_param_buf[]
>> size as libata parameters buffer doesn't need to be bigger than
>> the command line buffer.
>>
>> For many architectures this results in decreased libata-core.o
>> size (COMMAND_LINE_SIZE varies from 256 to 4096 while the minimum
>> PAGE_SIZE is 4096).
>>
>> Code size savings on m68k arch using atari_defconfig:
>>
>>    text    data     bss     dec     hex filename
>> before:
>>   41064    4413      40   45517    b1cd drivers/ata/libata-core.o
>> after:
>>   41064     573      40   41677    a2cd drivers/ata/libata-core.o
>>
>> Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
> 
> This looks like a good start, so:
> 
> Reviewed-by: Christoph Hellwig <hch@lst.de>

Thanks.

> But evne COMMAND_LINE_SIZE is quite a lot of overhead.  Can we maybe add
> a new Kconfig option to optionally disable the libata.force= entirely?

I've added patch making "libata.force=" optional in v2
(disabling "libata.force=" saves us additional 3kB).

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics
diff mbox series

Patch

diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index fa36e3248039..9b824788d04f 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -52,6 +52,7 @@ 
 #include <linux/leds.h>
 #include <linux/pm_runtime.h>
 #include <linux/platform_device.h>
+#include <asm/setup.h>
 
 #define CREATE_TRACE_POINTS
 #include <trace/events/libata.h>
@@ -106,7 +107,7 @@  struct ata_force_ent {
 static struct ata_force_ent *ata_force_tbl;
 static int ata_force_tbl_size;
 
-static char ata_force_param_buf[PAGE_SIZE] __initdata;
+static char ata_force_param_buf[COMMAND_LINE_SIZE] __initdata;
 /* param_buf is thrown away after initialization, disallow read */
 module_param_string(force, ata_force_param_buf, sizeof(ata_force_param_buf), 0);
 MODULE_PARM_DESC(force, "Force ATA configurations including cable type, link speed and transfer mode (see Documentation/admin-guide/kernel-parameters.rst for details)");