Commit Graph

2 Commits

Author SHA1 Message Date
Jianxiong Pan 71008eab74 mm: save wasted memory by slab. [2/2]
PD#SWPL-73422

Problem:
When driver/kernel call kmalloc with large size, memory may waste
if size is not equal to 2^n. For example, driver call kmalloc with
size 129KB, kmalloc will allocate a 256KB memory block to caller.
Then 127kb memory will be wasted if this caller do not free it.

Solution:
Free tail of slab memory if size is not match to 2^n. This change
can save about 900KB memory after boot, and more than 100KB durning
runtime.

Verify:
local.

Change-Id: I19cfbdddc92b1c2050cbc17ea65feb4b01f0445d
Signed-off-by: Jianxiong Pan <jianxiong.pan@amlogic.com>
2022-03-06 18:36:14 -07:00
Jianxiong Pan 5ff1e95368 mm: forward memory reclaim process. [1/2]
PD#SWPL-73189

Problem:
memory reclaim process is usually do when first allocate failed from buddy.
This will cause some process crash especially when memory is low, because
there is not enough time to do reclaim process.

Solution:
try to wake up kswapd process to reclaim memory if free memory is less
than high water mark. After apply this change, free memory is usually
keeps high than high_water mark.

Verify:
local.

Change-Id: I9c5f90bba778aacfe21aacb332ed19ad162b048b
Signed-off-by: Jianxiong Pan <jianxiong.pan@amlogic.com>
2022-02-27 23:18:43 -07:00