diff mbox series

[LEDE-DEV] config: add option to select kernel compile optimization type

Message ID 1516269045-10217-1-git-send-email-koen.vandeputte@ncentric.com
State Changes Requested
Delegated to: John Crispin
Headers show
Series [LEDE-DEV] config: add option to select kernel compile optimization type | expand

Commit Message

Koen Vandeputte Jan. 18, 2018, 9:50 a.m. UTC
A lot of targets have more than sufficient space to allow
building the kernel for speed iso size.

Export this performance option to the main config:

- Making it easy accessable for users
- Discarding the need to adjust it in the kernel config each time
when building from scratch and only using "make oldconfig"

Compiling for size is still the default.

Purely informational:

On my cns3xxx board, kernel size increases by ~100kB
but boot time decreased by ~8%.

Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
---
 config/Config-kernel.in | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

Comments

Kevin Darbyshire-Bryant Jan. 21, 2018, 9:39 a.m. UTC | #1
> On 18 Jan 2018, at 09:50, Koen Vandeputte <koen.vandeputte@ncentric.com> wrote:
> 
> A lot of targets have more than sufficient space to allow
> building the kernel for speed iso size.
> 
> Export this performance option to the main config:
> 
> - Making it easy accessable for users
> - Discarding the need to adjust it in the kernel config each time
> when building from scratch and only using "make oldconfig"
> 
> Compiling for size is still the default.
> 
> Purely informational:
> 
> On my cns3xxx board, kernel size increases by ~100kB
> but boot time decreased by ~8%.
> 
> Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>

Useful option - means I can drop a local commit :-)

Tested-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>

Cheers,

Kevin D-B

012C ACB2 28C6 C53E 9775  9123 B3A2 389B 9DE2 334A
Jonas Gorski Jan. 21, 2018, 12:37 p.m. UTC | #2
Hi,

On 18 January 2018 at 10:50, Koen Vandeputte
<koen.vandeputte@ncentric.com> wrote:
> A lot of targets have more than sufficient space to allow
> building the kernel for speed iso size.
>
> Export this performance option to the main config:
>
> - Making it easy accessable for users
> - Discarding the need to adjust it in the kernel config each time
> when building from scratch and only using "make oldconfig"
>
> Compiling for size is still the default.

This would be a "regression" for layerscape, as this target sets
CC_OPTIMIZE_FOR_PERFORMANCE to y.

>
> Purely informational:
>
> On my cns3xxx board, kernel size increases by ~100kB
> but boot time decreased by ~8%.
>
> Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
> ---
>  config/Config-kernel.in | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
>
> diff --git a/config/Config-kernel.in b/config/Config-kernel.in
> index fa06b5044219..b98c5dd04591 100644
> --- a/config/Config-kernel.in
> +++ b/config/Config-kernel.in
> @@ -194,6 +194,22 @@ config KERNEL_DEBUG_GPIO
>         bool "Compile the kernel with gpio debugging"
>         select KERNEL_DEBUG_KERNEL
>
> +config KERNEL_CC_OPTIMIZE_FOR_PERFORMANCE
> +        bool
> +        default y if COMPILE_KERNEL_FOR_SPEED
> +        default n
> +
> +config KERNEL_CC_OPTIMIZE_FOR_SIZE
> +        bool
> +        default n if COMPILE_KERNEL_FOR_SPEED
> +        default y
> +
> +config COMPILE_KERNEL_FOR_SPEED
> +        bool "Optimize the kernel for speed instead of size"
> +        default n
> +        help
> +          This will compile your kernel for maximum speed (-O2) instead of smaller size (-Os)

The kernel uses a choice here, so I think it would be better to just
copy that. One less config option as well.

Also the options should be removed from the kernel configs then.


Regards
Jonas
Arjen de Korte Jan. 21, 2018, 12:46 p.m. UTC | #3
Citeren Jonas Gorski <jonas.gorski@gmail.com>:

> Hi,
>
> On 18 January 2018 at 10:50, Koen Vandeputte
> <koen.vandeputte@ncentric.com> wrote:
>> A lot of targets have more than sufficient space to allow
>> building the kernel for speed iso size.
>>
>> Export this performance option to the main config:
>>
>> - Making it easy accessable for users
>> - Discarding the need to adjust it in the kernel config each time
>> when building from scratch and only using "make oldconfig"
>>
>> Compiling for size is still the default.
>
> This would be a "regression" for layerscape, as this target sets
> CC_OPTIMIZE_FOR_PERFORMANCE to y.
>
>>
>> Purely informational:
>>
>> On my cns3xxx board, kernel size increases by ~100kB
>> but boot time decreased by ~8%.
>>
>> Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
>> ---
>>  config/Config-kernel.in | 16 ++++++++++++++++
>>  1 file changed, 16 insertions(+)
>>
>> diff --git a/config/Config-kernel.in b/config/Config-kernel.in
>> index fa06b5044219..b98c5dd04591 100644
>> --- a/config/Config-kernel.in
>> +++ b/config/Config-kernel.in
>> @@ -194,6 +194,22 @@ config KERNEL_DEBUG_GPIO
>>         bool "Compile the kernel with gpio debugging"
>>         select KERNEL_DEBUG_KERNEL
>>
>> +config KERNEL_CC_OPTIMIZE_FOR_PERFORMANCE
>> +        bool
>> +        default y if COMPILE_KERNEL_FOR_SPEED
>> +        default n
>> +
>> +config KERNEL_CC_OPTIMIZE_FOR_SIZE
>> +        bool
>> +        default n if COMPILE_KERNEL_FOR_SPEED
>> +        default y
>> +
>> +config COMPILE_KERNEL_FOR_SPEED
>> +        bool "Optimize the kernel for speed instead of size"
>> +        default n
>> +        help
>> +          This will compile your kernel for maximum speed (-O2)  
>> instead of smaller size (-Os)
>
> The kernel uses a choice here, so I think it would be better to just
> copy that. One less config option as well.
>
> Also the options should be removed from the kernel configs then.

One thing that wonders me, couldn't the option CONFIG_TARGET_OPTIONS=y  
and CONFIG_TARGET_OPTIMIZATION that is already available be used for  
this as well? So far I have used this to set the optimization used,  
which seems to do the job just fine (for the whole target, not just  
the kernel).
Koen Vandeputte Jan. 22, 2018, 9:17 a.m. UTC | #4
On 2018-01-21 13:46, Arjen de Korte wrote:
> Citeren Jonas Gorski <jonas.gorski@gmail.com>:
>
>> Hi,
>>
>> On 18 January 2018 at 10:50, Koen Vandeputte
>> <koen.vandeputte@ncentric.com> wrote:
>>> A lot of targets have more than sufficient space to allow
>>> building the kernel for speed iso size.
>>>
>>> Export this performance option to the main config:
>>>
>>> - Making it easy accessable for users
>>> - Discarding the need to adjust it in the kernel config each time
>>> when building from scratch and only using "make oldconfig"
>>>
>>> Compiling for size is still the default.
>>
>> This would be a "regression" for layerscape, as this target sets
>> CC_OPTIMIZE_FOR_PERFORMANCE to y.
>>
>>>
>>> Purely informational:
>>>
>>> On my cns3xxx board, kernel size increases by ~100kB
>>> but boot time decreased by ~8%.
>>>
>>> Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
>>> ---
>>>  config/Config-kernel.in | 16 ++++++++++++++++
>>>  1 file changed, 16 insertions(+)
>>>
>>> diff --git a/config/Config-kernel.in b/config/Config-kernel.in
>>> index fa06b5044219..b98c5dd04591 100644
>>> --- a/config/Config-kernel.in
>>> +++ b/config/Config-kernel.in
>>> @@ -194,6 +194,22 @@ config KERNEL_DEBUG_GPIO
>>>         bool "Compile the kernel with gpio debugging"
>>>         select KERNEL_DEBUG_KERNEL
>>>
>>> +config KERNEL_CC_OPTIMIZE_FOR_PERFORMANCE
>>> +        bool
>>> +        default y if COMPILE_KERNEL_FOR_SPEED
>>> +        default n
>>> +
>>> +config KERNEL_CC_OPTIMIZE_FOR_SIZE
>>> +        bool
>>> +        default n if COMPILE_KERNEL_FOR_SPEED
>>> +        default y
>>> +
>>> +config COMPILE_KERNEL_FOR_SPEED
>>> +        bool "Optimize the kernel for speed instead of size"
>>> +        default n
>>> +        help
>>> +          This will compile your kernel for maximum speed (-O2) 
>>> instead of smaller size (-Os)
>>
>> The kernel uses a choice here, so I think it would be better to just
>> copy that. One less config option as well.
>>
>> Also the options should be removed from the kernel configs then.
>
> One thing that wonders me, couldn't the option CONFIG_TARGET_OPTIONS=y 
> and CONFIG_TARGET_OPTIMIZATION that is already available be used for 
> this as well? So far I have used this to set the optimization used, 
> which seems to do the job just fine (for the whole target, not just 
> the kernel).
>
>
Only packages are affected by this flag. (If they don't override it by 
setting -O flags themselves)

Also, using this one for the kernel too changes building to "all or nothing"
Depending on target space, it can be useful to just have a fast kernel 
(O2), with slower packages (Os)  or vice-versa
Koen Vandeputte Jan. 22, 2018, 9:20 a.m. UTC | #5
On 2018-01-21 13:37, Jonas Gorski wrote:
> Hi,
>
> On 18 January 2018 at 10:50, Koen Vandeputte
> <koen.vandeputte@ncentric.com> wrote:
>> A lot of targets have more than sufficient space to allow
>> building the kernel for speed iso size.
>>
>> Export this performance option to the main config:
>>
>> - Making it easy accessable for users
>> - Discarding the need to adjust it in the kernel config each time
>> when building from scratch and only using "make oldconfig"
>>
>> Compiling for size is still the default.
> This would be a "regression" for layerscape, as this target sets
> CC_OPTIMIZE_FOR_PERFORMANCE to y.
>
>> Purely informational:
>>
>> On my cns3xxx board, kernel size increases by ~100kB
>> but boot time decreased by ~8%.
>>
>> Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
>> ---
>>   config/Config-kernel.in | 16 ++++++++++++++++
>>   1 file changed, 16 insertions(+)
>>
>> diff --git a/config/Config-kernel.in b/config/Config-kernel.in
>> index fa06b5044219..b98c5dd04591 100644
>> --- a/config/Config-kernel.in
>> +++ b/config/Config-kernel.in
>> @@ -194,6 +194,22 @@ config KERNEL_DEBUG_GPIO
>>          bool "Compile the kernel with gpio debugging"
>>          select KERNEL_DEBUG_KERNEL
>>
>> +config KERNEL_CC_OPTIMIZE_FOR_PERFORMANCE
>> +        bool
>> +        default y if COMPILE_KERNEL_FOR_SPEED
>> +        default n
>> +
>> +config KERNEL_CC_OPTIMIZE_FOR_SIZE
>> +        bool
>> +        default n if COMPILE_KERNEL_FOR_SPEED
>> +        default y
>> +
>> +config COMPILE_KERNEL_FOR_SPEED
>> +        bool "Optimize the kernel for speed instead of size"
>> +        default n
>> +        help
>> +          This will compile your kernel for maximum speed (-O2) instead of smaller size (-Os)
> The kernel uses a choice here, so I think it would be better to just
> copy that. One less config option as well.
Hi Jonas,

Could you elaborate a bit more on this specific point?
I'm not quite fully understanding your proposal here.

Thanks
> Also the options should be removed from the kernel configs then.

>
> Regards
> Jonas
Jonas Gorski Jan. 22, 2018, 9:50 a.m. UTC | #6
On 22 January 2018 at 10:20, Koen Vandeputte
<koen.vandeputte@ncentric.com> wrote:
>
>
> On 2018-01-21 13:37, Jonas Gorski wrote:
>>
>> Hi,
>>
>> On 18 January 2018 at 10:50, Koen Vandeputte
>> <koen.vandeputte@ncentric.com> wrote:
>>>
>>> A lot of targets have more than sufficient space to allow
>>> building the kernel for speed iso size.
>>>
>>> Export this performance option to the main config:
>>>
>>> - Making it easy accessable for users
>>> - Discarding the need to adjust it in the kernel config each time
>>> when building from scratch and only using "make oldconfig"
>>>
>>> Compiling for size is still the default.
>>
>> This would be a "regression" for layerscape, as this target sets
>> CC_OPTIMIZE_FOR_PERFORMANCE to y.
>>
>>> Purely informational:
>>>
>>> On my cns3xxx board, kernel size increases by ~100kB
>>> but boot time decreased by ~8%.
>>>
>>> Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
>>> ---
>>>   config/Config-kernel.in | 16 ++++++++++++++++
>>>   1 file changed, 16 insertions(+)
>>>
>>> diff --git a/config/Config-kernel.in b/config/Config-kernel.in
>>> index fa06b5044219..b98c5dd04591 100644
>>> --- a/config/Config-kernel.in
>>> +++ b/config/Config-kernel.in
>>> @@ -194,6 +194,22 @@ config KERNEL_DEBUG_GPIO
>>>          bool "Compile the kernel with gpio debugging"
>>>          select KERNEL_DEBUG_KERNEL
>>>
>>> +config KERNEL_CC_OPTIMIZE_FOR_PERFORMANCE
>>> +        bool
>>> +        default y if COMPILE_KERNEL_FOR_SPEED
>>> +        default n
>>> +
>>> +config KERNEL_CC_OPTIMIZE_FOR_SIZE
>>> +        bool
>>> +        default n if COMPILE_KERNEL_FOR_SPEED
>>> +        default y
>>> +
>>> +config COMPILE_KERNEL_FOR_SPEED
>>> +        bool "Optimize the kernel for speed instead of size"
>>> +        default n
>>> +        help
>>> +          This will compile your kernel for maximum speed (-O2) instead
>>> of smaller size (-Os)
>>
>> The kernel uses a choice here, so I think it would be better to just
>> copy that. One less config option as well.
>
> Hi Jonas,
>
> Could you elaborate a bit more on this specific point?
> I'm not quite fully understanding your proposal here.

See http://elixir.free-electrons.com/linux/latest/source/init/Kconfig#L1034


Regards
Jonas
diff mbox series

Patch

diff --git a/config/Config-kernel.in b/config/Config-kernel.in
index fa06b5044219..b98c5dd04591 100644
--- a/config/Config-kernel.in
+++ b/config/Config-kernel.in
@@ -194,6 +194,22 @@  config KERNEL_DEBUG_GPIO
 	bool "Compile the kernel with gpio debugging"
 	select KERNEL_DEBUG_KERNEL
 
+config KERNEL_CC_OPTIMIZE_FOR_PERFORMANCE
+        bool
+        default y if COMPILE_KERNEL_FOR_SPEED
+        default n
+
+config KERNEL_CC_OPTIMIZE_FOR_SIZE
+        bool
+        default n if COMPILE_KERNEL_FOR_SPEED
+        default y
+
+config COMPILE_KERNEL_FOR_SPEED
+        bool "Optimize the kernel for speed instead of size"
+        default n
+        help
+          This will compile your kernel for maximum speed (-O2) instead of smaller size (-Os)
+
 config KERNEL_COREDUMP
 	bool