ANDROID: ABI: export psi_system for memcgv2's vh function
optimization
Export psi_system symbol to be used by memcgv2 optimization mechanism.
psi_system will be used for monitoring system's memory pressure in
trace_android_rvh_memcgv2_calc_decayed_watermark.
For some kind of memcg, the usage is varies greatly from scenarios.
Such as multimedia app could have the usage range from 50MB to 500MB,
which generated by loading an special algorithm into its virtual address
space and make it hard to protect the expanded usage without userspace's
interaction.
Furthermore, fixed memory.low is a little bit against its role of soft
protection as it will response any system's memory pressure in same way.
Taking all above into consideration, we introduce a kind of dynamic
protection based on group's watermark and system's memory pressure in
this patch.
Our aims are:
1. dynamic protection with no fixed setting
2. proper protection value on memory.current
3. time based decay protection
4. memory pressue related protection
The basic concept could be descripted as bellowing, where we take
group->watermark
as a representative of usage
group->memory.low = decayed_watermark * decay_factor
decayed_watermark = group->watermark * func_wm_decay(time)
decay_factor = psi_system[PSI_MEM][time]
func_wm_decay could be deemed as a linear decay funcion that will decay 1/2
in 68s(36bit).If we take 2048 as "1", it could be descripted as:
decayed_watermark = time >> (group->wm_dec_factor - 10)
decayed_watermark = new_usage(if new_usage > decayed_watermark)
decay_factor is as simple as a table lookingup and compose the final value
by weight of some and full as
some = psi_system.avg[PSI_MEM * 2][time]
full = psi_system.avg[PSI_MEM * 2 + 1][time]
decay_factor = some + full * 2
We simply test above change by comparing it with current design on a v5.4
based system in 3GB RAM in bellowing steps, via which we can find that fixed
memory.low have the system experience high memory pressure with holding too
much memory.
1. setting up the topology seperatly as [1]
2. place a memory cost process into B and have it consume 1GB memory
from userspace.
3. generating global memory pressure via mlock 1GB memory.
4. watching B's memory.current and PSI_MEM.
5. repeat 3,4 twice.
[1]. setting fixed low=500MB; low=600MB; wm_decay_factor=36(68s decay 1/2)
A(low=500MB)
/
B(low=500MB)
What we observed are:
PSI_MEM, usage PSI_MEM,usage PSI_MEM,usage
(Mlock 1GB) (Mlock 2GB) (stable)
low=600MB s=23 f=17 u=720/600MB s=91 f=48 u=202MB s=68 f=32 u=106MB
low=500MB s=22 f=13 u=660/530MB s=88 f=50 u=156MB s=30 f=20 u=120MB
patch s=23 f=12 u=692/470MB s=40 f=23 u=67MB s=21 f=18 u=45MB
Bug: 253968145
Change-Id: I19d46ef20c17dff6f057452ddc8baa3724d2c65d
Signed-off-by: zhaoyang.huang <zhaoyang.huang@unisoc.com>
This commit is contained in:
committed by
Suren Baghdasaryan
parent
ecb0dcb24a
commit
6d81bca908
@@ -186,7 +186,7 @@ static DEFINE_PER_CPU(struct psi_group_cpu, system_group_pcpu);
|
||||
struct psi_group psi_system = {
|
||||
.pcpu = &system_group_pcpu,
|
||||
};
|
||||
|
||||
EXPORT_SYMBOL_GPL(psi_system);
|
||||
static void psi_avgs_work(struct work_struct *work);
|
||||
|
||||
static void poll_timer_fn(struct timer_list *t);
|
||||
|
||||
Reference in New Issue
Block a user