diff mbox series

base-files: update min_free_kbytes configuration

Message ID 20240103023218.274699-1-quic_shoudil@quicinc.com
State Changes Requested
Delegated to: Petr Štetiar
Headers show
Series base-files: update min_free_kbytes configuration | expand

Commit Message

Shoudi Li (Stephen) Jan. 3, 2024, 2:32 a.m. UTC
From: Zhuo Fu <quic_zfu@quicinc.com>

set proper min_free_kbytes for small RAM device to avoid
OOM during device boot up.

Signed-off-by: shoudil <quic_shoudil@quicinc.com>
---
 package/base-files/files/etc/init.d/sysctl | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

Comments

Chuanhong Guo Jan. 3, 2024, 9:35 a.m. UTC | #1
(Adding Felix to CC list.)

Hi!

On Wed, Jan 3, 2024 at 10:34 AM <quic_shoudil@quicinc.com> wrote:
>
> From: Zhuo Fu <quic_zfu@quicinc.com>
>
> set proper min_free_kbytes for small RAM device to avoid
> OOM during device boot up.

Have you checked the original commit message [1] when this min_free limit
was added?
Some network drivers allocate memory in atomic context.
This limit was set to prevent memory allocation failure in these cases.

What devices/scenarios have you tested this change on?
How did you determine what's the proper value for this property?

>
> Signed-off-by: shoudil <quic_shoudil@quicinc.com>

You also need a sign-off from the original author Zhuo Fu here.

[1] https://git.openwrt.org/5c9cc7b7f8920944a413644e1c2ea23bfe655bcb
Shoudi Li (Stephen) Jan. 6, 2024, 1 a.m. UTC | #2
On 2024/1/3 17:35, Chuanhong Guo wrote:
> (Adding Felix to CC list.)
> 
> Hi!
> 
> On Wed, Jan 3, 2024 at 10:34 AM <quic_shoudil@quicinc.com> wrote:
>>
>> From: Zhuo Fu <quic_zfu@quicinc.com>
>>
>> set proper min_free_kbytes for small RAM device to avoid
>> OOM during device boot up.
> 
> Have you checked the original commit message [1] when this min_free limit
> was added?
> Some network drivers allocate memory in atomic context.
> This limit was set to prevent memory allocation failure in these cases.
> 
  We are not clear on the issue case fixed by the original commit, so 
not verify it.we will check if possible to reproduce the issue on our 
device next.

> What devices/scenarios have you tested this change on?
> How did you determine what's the proper value for this property?
> 
   The value is adjusted based on QCOM's MBB (modem based board) kuno 
(sdx35) device, which is low memory configured, OOM issue hit during 
boot up, thus tuned the value to fix this OOM.

>>
>> Signed-off-by: shoudil <quic_shoudil@quicinc.com>
> 
> You also need a sign-off from the original author Zhuo Fu here.
> 
> [1] https://git.openwrt.org/5c9cc7b7f8920944a413644e1c2ea23bfe655bcb
diff mbox series

Patch

diff --git a/package/base-files/files/etc/init.d/sysctl b/package/base-files/files/etc/init.d/sysctl
index 4db56444c7..742a978cee 100755
--- a/package/base-files/files/etc/init.d/sysctl
+++ b/package/base-files/files/etc/init.d/sysctl
@@ -7,12 +7,14 @@  apply_defaults() {
 	local mem="$(awk '/^MemTotal:/ {print $2}' /proc/meminfo)"
 	local min_free frag_low_thresh frag_high_thresh
 
-	if [ "$mem" -gt 65536 ]; then # 128M
+	if [ "$mem" -gt 262144 ]; then # 512M
 		min_free=16384
-	elif [ "$mem" -gt 32768 ]; then # 64M
-		min_free=8192
+	elif [ "$mem" -gt 131072 ]; then # 256M
+		min_free=3072
+	elif [ "$mem" -gt 32768 ]; then # 64M or 128M
+		min_free=512
 	else
-		min_free=1024
+		min_free=512
 		frag_low_thresh=393216
 		frag_high_thresh=524288
 	fi