kernel: Reduce memory usage by reducing squashfs fragment cache size

Submitted by Fabian Blaese on March 28, 2020, 4:09 p.m.

Details

Message ID 20200328160958.214225-1-fabian@blaese.de
State Accepted
Headers show

Commit Message

Fabian Blaese March 28, 2020, 4:09 p.m.
Reducing the amount of squashfs fragments cached in memory might reduce
memory usage, especially for systems with very little memory and
big squashfs blocksizes.

Because only ar71xx-tiny contains 32/4 (memory/flash) devices, the
reduction of the fragment cache is only applied to th ar71xx bsp.

Signed-off-by: Fabian Bläse <fabian@blaese.de>
---
 bsp/ar71xx/.config | 1 +
 1 file changed, 1 insertion(+)

Patch hide | download patch | download mbox

diff --git a/bsp/ar71xx/.config b/bsp/ar71xx/.config
index 6c2c730..0b9a367 100644
--- a/bsp/ar71xx/.config
+++ b/bsp/ar71xx/.config
@@ -96,6 +96,7 @@  CONFIG_CLEAN_IPKG=y
 # CONFIG_FASTD_ENABLE_METHOD_COMPOSED_UMAC is not set
 # CONFIG_FASTD_ENABLE_METHOD_GENERIC_GMAC is not set
 # CONFIG_FASTD_ENABLE_METHOD_GENERIC_UMAC is not set
+CONFIG_KERNEL_SQUASHFS_FRAGMENT_CACHE_SIZE=1
 # CONFIG_PACKAGE_ALFRED_VIS is not set
 CONFIG_PACKAGE_hostapd-mini=y
 CONFIG_PACKAGE_iwinfo=m

Comments

Robert Langhammer March 28, 2020, 5:43 p.m.
Hi Fabian,

wenn's hilft.

Reviewed-by: Robert Langhammer <rlanghammer@web.de>

Hast du das mal ausprobiert? Bringt das was?

Am 28.03.20 um 17:09 schrieb Fabian Bläse:
> Reducing the amount of squashfs fragments cached in memory might reduce
> memory usage, especially for systems with very little memory and
> big squashfs blocksizes.
>
> Because only ar71xx-tiny contains 32/4 (memory/flash) devices, the
> reduction of the fragment cache is only applied to th ar71xx bsp.
>
> Signed-off-by: Fabian Bläse <fabian@blaese.de>
> ---
>  bsp/ar71xx/.config | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/bsp/ar71xx/.config b/bsp/ar71xx/.config
> index 6c2c730..0b9a367 100644
> --- a/bsp/ar71xx/.config
> +++ b/bsp/ar71xx/.config
> @@ -96,6 +96,7 @@ CONFIG_CLEAN_IPKG=y
>  # CONFIG_FASTD_ENABLE_METHOD_COMPOSED_UMAC is not set
>  # CONFIG_FASTD_ENABLE_METHOD_GENERIC_GMAC is not set
>  # CONFIG_FASTD_ENABLE_METHOD_GENERIC_UMAC is not set
> +CONFIG_KERNEL_SQUASHFS_FRAGMENT_CACHE_SIZE=1
>  # CONFIG_PACKAGE_ALFRED_VIS is not set
>  CONFIG_PACKAGE_hostapd-mini=y
>  CONFIG_PACKAGE_iwinfo=m
Fabian Blaese March 28, 2020, 6:17 p.m.
Das ist ziemlich schwer zu quantifizieren.
Ich denke aber, dass es nicht schaden wird.

On 28.03.20 18:43, Robert Langhammer wrote:
> Hi Fabian,
> 
> wenn's hilft.
> 
> Reviewed-by: Robert Langhammer <rlanghammer@web.de>
> 
> Hast du das mal ausprobiert? Bringt das was?
> 
> Am 28.03.20 um 17:09 schrieb Fabian Bläse:
>> Reducing the amount of squashfs fragments cached in memory might reduce
>> memory usage, especially for systems with very little memory and
>> big squashfs blocksizes.
>>
>> Because only ar71xx-tiny contains 32/4 (memory/flash) devices, the
>> reduction of the fragment cache is only applied to th ar71xx bsp.
>>
>> Signed-off-by: Fabian Bläse <fabian@blaese.de>
>> ---
>>  bsp/ar71xx/.config | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/bsp/ar71xx/.config b/bsp/ar71xx/.config
>> index 6c2c730..0b9a367 100644
>> --- a/bsp/ar71xx/.config
>> +++ b/bsp/ar71xx/.config
>> @@ -96,6 +96,7 @@ CONFIG_CLEAN_IPKG=y
>>  # CONFIG_FASTD_ENABLE_METHOD_COMPOSED_UMAC is not set
>>  # CONFIG_FASTD_ENABLE_METHOD_GENERIC_GMAC is not set
>>  # CONFIG_FASTD_ENABLE_METHOD_GENERIC_UMAC is not set
>> +CONFIG_KERNEL_SQUASHFS_FRAGMENT_CACHE_SIZE=1
>>  # CONFIG_PACKAGE_ALFRED_VIS is not set
>>  CONFIG_PACKAGE_hostapd-mini=y
>>  CONFIG_PACKAGE_iwinfo=m
Adrian Schmutzler March 28, 2020, 6:18 p.m.
Was ist denn der Nachteil davon, also der Grund, warum das nicht by-default gemacht wird?

> -----Original Message-----
> From: franken-dev [mailto:franken-dev-bounces@freifunk.net] On Behalf
> Of Fabian Bläse
> Sent: Samstag, 28. März 2020 17:10
> To: franken-dev@freifunk.net
> Subject: [PATCH] kernel: Reduce memory usage by reducing squashfs
> fragment cache size
> 
> Reducing the amount of squashfs fragments cached in memory might reduce
> memory usage, especially for systems with very little memory and big
> squashfs blocksizes.
> 
> Because only ar71xx-tiny contains 32/4 (memory/flash) devices, the
> reduction of the fragment cache is only applied to th ar71xx bsp.
> 
> Signed-off-by: Fabian Bläse <fabian@blaese.de>
> ---
>  bsp/ar71xx/.config | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/bsp/ar71xx/.config b/bsp/ar71xx/.config index 6c2c730..0b9a367
> 100644
> --- a/bsp/ar71xx/.config
> +++ b/bsp/ar71xx/.config
> @@ -96,6 +96,7 @@ CONFIG_CLEAN_IPKG=y
>  # CONFIG_FASTD_ENABLE_METHOD_COMPOSED_UMAC is not set  #
> CONFIG_FASTD_ENABLE_METHOD_GENERIC_GMAC is not set  #
> CONFIG_FASTD_ENABLE_METHOD_GENERIC_UMAC is not set
> +CONFIG_KERNEL_SQUASHFS_FRAGMENT_CACHE_SIZE=1
>  # CONFIG_PACKAGE_ALFRED_VIS is not set
>  CONFIG_PACKAGE_hostapd-mini=y
>  CONFIG_PACKAGE_iwinfo=m
> --
> 2.26.0
Fabian Blaese March 28, 2020, 6:21 p.m.
Weniger dekomprimierter Kram im RAM -> Mehr Flashzugriffe und mehr CPU Zeit zum dekomprimieren.

Siehe auch:
- https://github.com/torvalds/linux/blob/master/Documentation/filesystems/squashfs.txt#L240
- https://github.com/torvalds/linux/blob/master/fs/squashfs/Kconfig#L218

Gruß
Fabian

On 28.03.20 19:18, mail@adrianschmutzler.de wrote:
> Was ist denn der Nachteil davon, also der Grund, warum das nicht by-default gemacht wird?
> 
>> -----Original Message-----
>> From: franken-dev [mailto:franken-dev-bounces@freifunk.net] On Behalf
>> Of Fabian Bläse
>> Sent: Samstag, 28. März 2020 17:10
>> To: franken-dev@freifunk.net
>> Subject: [PATCH] kernel: Reduce memory usage by reducing squashfs
>> fragment cache size
>>
>> Reducing the amount of squashfs fragments cached in memory might reduce
>> memory usage, especially for systems with very little memory and big
>> squashfs blocksizes.
>>
>> Because only ar71xx-tiny contains 32/4 (memory/flash) devices, the
>> reduction of the fragment cache is only applied to th ar71xx bsp.
>>
>> Signed-off-by: Fabian Bläse <fabian@blaese.de>
>> ---
>>  bsp/ar71xx/.config | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/bsp/ar71xx/.config b/bsp/ar71xx/.config index 6c2c730..0b9a367
>> 100644
>> --- a/bsp/ar71xx/.config
>> +++ b/bsp/ar71xx/.config
>> @@ -96,6 +96,7 @@ CONFIG_CLEAN_IPKG=y
>>  # CONFIG_FASTD_ENABLE_METHOD_COMPOSED_UMAC is not set  #
>> CONFIG_FASTD_ENABLE_METHOD_GENERIC_GMAC is not set  #
>> CONFIG_FASTD_ENABLE_METHOD_GENERIC_UMAC is not set
>> +CONFIG_KERNEL_SQUASHFS_FRAGMENT_CACHE_SIZE=1
>>  # CONFIG_PACKAGE_ALFRED_VIS is not set
>>  CONFIG_PACKAGE_hostapd-mini=y
>>  CONFIG_PACKAGE_iwinfo=m
>> --
>> 2.26.0
Adrian Schmutzler April 2, 2020, 11:15 a.m.
Applied.