Re: base-files: flush kernel memory cache during sysupgrade

2021-01-13 Thread Hannu Nyman

Stijn Segers kirjoitti 13.1.2021 klo 0.48:
Have tested this on a few low-RAM devices, among which a TL-WR841N v7 (32 
MiB) and a WNDR3700 v2 (64 MiB).


No idea if this is still necessary/wanted but would be nice to see this end 
up in master (and trickle down to 21.xx :-D ).


Tested-by: Stijn Segers 


Hi Stijn,

this has been merged already in December as commit 3d12b4798:

https://git.openwrt.org/?p=openwrt/openwrt.git;a=commit;h=3d12b47985fc1983849925d2dc23430f55210c80



___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: base-files: flush kernel memory cache during sysupgrade

2021-01-12 Thread Stijn Segers

Hi,

Have tested this on a few low-RAM devices, among which a TL-WR841N v7 
(32 MiB) and a WNDR3700 v2 (64 MiB).


No idea if this is still necessary/wanted but would be nice to see this 
end up in master (and trickle down to 21.xx :-D ).


Tested-by: Stijn Segers 



___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [PATCH] base-files: flush kernel memory cache during sysupgrade

2020-12-05 Thread Sven Roederer
Am Dienstag, 24. November 2020, 07:39:48 CET schrieb Hannu Nyman:
> Flush kernel memory caches during sysupgrade in order
> to mitigate the impact from memory consumption spikes
> in low-RAM devices.
> 
> This may help to prevent sysupgrade causing a reboot
> before the actual flashing starts.
> 
> Signed-off-by: Hannu Nyman 
> ---
> 
> I have noticed this to help in 64 MB WNDR3700v2, where sysupgrade
> typically has failed when the router has been running some time,
> but succeeded when sysupgrade is done right after a reboot.
> 

On a 8/32MB device (NanoStation M) it took several attemts to get a sysupgrade 
in place. With this change it mostly finished successfully on the 1st attempt.

> The cache flushing is non-destructive and as the router is going
> to sysupgrade, there aren't "long-term" performance issues.
> 

As it seems to have no sideeffects I would like to see this merged.


Best Sven

> Reference to mailing list discussion in
> http://lists.openwrt.org/pipermail/openwrt-devel/2020-November/032266.html
> 
> Kernel documentation:
> https://www.kernel.org/doc/Documentation/sysctl/vm.txt
> 
> 
>  package/base-files/files/lib/upgrade/common.sh | 1 +
>  package/base-files/files/lib/upgrade/stage2| 1 +
>  2 files changed, 2 insertions(+)
> 
> diff --git a/package/base-files/files/lib/upgrade/common.sh
> b/package/base-files/files/lib/upgrade/common.sh index
> a5c27dc2fb..b44a5998f4 100644
> --- a/package/base-files/files/lib/upgrade/common.sh
> +++ b/package/base-files/files/lib/upgrade/common.sh
> @@ -297,6 +297,7 @@ indicate_upgrade() {
>  # $(2): (optional) pipe command to extract firmware, e.g. dd bs=n skip=m
>  default_do_upgrade() {
>   sync
> + echo 3 > /proc/sys/vm/drop_caches
>   if [ -n "$UPGRADE_BACKUP" ]; then
>   get_image "$1" "$2" | mtd $MTD_ARGS $MTD_CONFIG_ARGS -j 
"$UPGRADE_BACKUP"
> write - "${PART_NAME:-image}" else
> diff --git a/package/base-files/files/lib/upgrade/stage2
> b/package/base-files/files/lib/upgrade/stage2 index c7629c383f..23d356a447
> 100755
> --- a/package/base-files/files/lib/upgrade/stage2
> +++ b/package/base-files/files/lib/upgrade/stage2
> @@ -123,6 +123,7 @@ kill_remaining KILL 1
> 
>  sleep 1
> 
> +echo 3 > /proc/sys/vm/drop_caches
> 
>  if [ -n "$IMAGE" ] && type 'platform_pre_upgrade' >/dev/null 2>/dev/null;
> then platform_pre_upgrade "$IMAGE"





___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[PATCH] base-files: flush kernel memory cache during sysupgrade

2020-11-23 Thread Hannu Nyman
Flush kernel memory caches during sysupgrade in order
to mitigate the impact from memory consumption spikes
in low-RAM devices.

This may help to prevent sysupgrade causing a reboot
before the actual flashing starts.

Signed-off-by: Hannu Nyman 
---

I have noticed this to help in 64 MB WNDR3700v2, where sysupgrade
typically has failed when the router has been running some time,
but succeeded when sysupgrade is done right after a reboot.

The cache flushing is non-destructive and as the router is going
to sysupgrade, there aren't "long-term" performance issues.

Reference to mailing list discussion in 
http://lists.openwrt.org/pipermail/openwrt-devel/2020-November/032266.html

Kernel documentation:
https://www.kernel.org/doc/Documentation/sysctl/vm.txt


 package/base-files/files/lib/upgrade/common.sh | 1 +
 package/base-files/files/lib/upgrade/stage2| 1 +
 2 files changed, 2 insertions(+)

diff --git a/package/base-files/files/lib/upgrade/common.sh 
b/package/base-files/files/lib/upgrade/common.sh
index a5c27dc2fb..b44a5998f4 100644
--- a/package/base-files/files/lib/upgrade/common.sh
+++ b/package/base-files/files/lib/upgrade/common.sh
@@ -297,6 +297,7 @@ indicate_upgrade() {
 # $(2): (optional) pipe command to extract firmware, e.g. dd bs=n skip=m
 default_do_upgrade() {
sync
+   echo 3 > /proc/sys/vm/drop_caches
if [ -n "$UPGRADE_BACKUP" ]; then
get_image "$1" "$2" | mtd $MTD_ARGS $MTD_CONFIG_ARGS -j 
"$UPGRADE_BACKUP" write - "${PART_NAME:-image}"
else
diff --git a/package/base-files/files/lib/upgrade/stage2 
b/package/base-files/files/lib/upgrade/stage2
index c7629c383f..23d356a447 100755
--- a/package/base-files/files/lib/upgrade/stage2
+++ b/package/base-files/files/lib/upgrade/stage2
@@ -123,6 +123,7 @@ kill_remaining KILL 1
 
 sleep 1
 
+echo 3 > /proc/sys/vm/drop_caches
 
 if [ -n "$IMAGE" ] && type 'platform_pre_upgrade' >/dev/null 2>/dev/null; then
platform_pre_upgrade "$IMAGE"
-- 
2.27.0


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel