Title: Samsung Enterprise Portal mySingle

 

On Wednesday 03 December 2014 08:42:41 Thiago Macieira <thiago.macie...@intel.com>
said:
> > > The only way for userspace to get the information is via /proc/*/smaps
> > > and
> > > that is not sufficient. For this daemon to work, we should really get a
> > > kernel feature.
> >
> > we also need events from the kernel. a kernel event saying "help  - we are
> > low on memory - please do something now!". otherwise this daemon is left to
> > have to poll and polling is not pretty on power and means the best response
> > time of a "memory shortage" is dependent on polling interval.. and this is
> > an eternal fight between power usage and response. events please.
>
> Agreed. We need that information *before* we run out of memory. When the OOM
> killer triggers, as Dominique said, all hope is probably lost.
>
> A simple implementation of the resource manager could simply monitor
> ./proc/meminfo and then notify applications when it thinks resources go low. I
> see problems with that:
>
> 1) polling, like you said
> 2) polling intervals will get higher if the system is out of memory, so a
>     runaway application will cause the daemon to fail to report properly
>     (you could run it in real-time priority, but this will open another can of 
>      worms)

Memory cgroup will be used to getting the memory state from kernel.

Memory cgroup supports memory pressure notifier and usage threshold notifier.

resourced uses the memory pressure notifier, and thus it can recognize

if available memory size is low.

Please refer the document https://www.kernel.org/doc/Documentation/cgroups/memory.txt (11. Memory pressure)


> 3) which applications does the manager notify? All of them? Then you trigger
>     "thundering herd" problem and you'll probably cause *more* memory to be
>      allocated, especially if portions of some of the targeted applications
>      had been swapped out or dropped from RSS

> 4) if it's targetting, how will it get the right information? Remember what I
>     said about /proc/*/smaps

resoured manages user applications (Root daemons are managed by systemd).

All of applications use app-core, and app-core registers signal from resourced.

Thus applications can receive the broadcast signal from resourced and call

malloc_trim() function automatically when available memory size of low.

 

If available memory size is very low, resourced selects victim applications

and terminates them. The criterion to select victims is oom_score_adj value.

Background processes have higher oom_score_adj value than foreground processes,

and processes recently changed to background have lower oom_score_adj value

than other background processes. Thus processes which have higher oom_score_adj

are selected as victims.

 

The available memory size is obtained by checking /proc/meminfo.

 

Thank you.

 




 

 

Taeyoung, Kim | SW Engineer

System S/W Lab./ S/W Platform Team

Software R&D Center

SAMSUNG ELECTRONICS CO., LTD.

 Mobile  +82.10.5133.9902

 E_mail   ty317....@samsung.com

 

_______________________________________________
Dev mailing list
Dev@lists.tizen.org
https://lists.tizen.org/listinfo/dev

Reply via email to