[LTP] controllers/memcg_stress: Does not work correctly?

Michal Hocko mhocko@suse.cz
Wed Nov 18 16:34:44 CET 2015


On Mon 16-11-15 12:57:30, Cyril Hrubis wrote:
> Hi!
> > About testcase "controllers/memcg_stress", I have a question.
> > 
> > This test calculates a memory size to use on a test as follows.
> > ------
> > - testcases/kernel/controllers/memcg/stress/memcg_stress_test.sh
> > 
> >   mem_free=`cat /proc/meminfo | grep MemFree | awk '{ print $2 }'`
> >   swap_free=`cat /proc/meminfo | grep SwapFree | awk '{ print $2 }'`
> > 
> >   mem=$(( $mem_free + $swap_free / 2 ))
> >   mem=$(( mem / 1024 ))
> > ------
> > 
> > In the case of this calculation, Lack of memory occurs when this test runs in "swap off" systems.

I am not sure I understand what is the actual problem. Swap off system
will not have any swap available. Or did you mean that the swap off will
happen during the test? If yes then the test case is clearly not
prepared for that and it would get killed by the OOM killer.

I am not entirely sure I understand the purpose of the test case but it
seems it just wants to generate the global memory pressure via memcg
loads. Whether that is a useful test is hard to judge. What is the
pass/fail metric? If the failure is the OOM killer then this is
extremely fragile because of what Cyril mentions below:
 
> My guess is that the test fails to account for memory consumed by the
> system when forking processes, system reserve, page tables, etc. And
> that it works just fine in case there is enough swap space. The second
> test actually tries to reserve 150MB but the first one just blindly
> allocates and page-faults all free memory.
> 
> > As for the calculation of the memory size to use for a test, may the following be right?
> > ------
> > - testcases/kernel/controllers/memcg/stress/memcg_stress_test.sh
> > 
> >   mem_free=`cat /proc/meminfo | grep MemFree | awk '{ print $2 }'`
> >   swap_free=`cat /proc/meminfo | grep SwapFree | awk '{ print $2 }'`
> > 
> >   mem=$(( ($mem_free + $swap_free) / 2 ))
> >   mem=$(( mem / 1024 ))
> 
> Hmm, halving the memory is likely too much. I would guess that we need
> to reserve something as 10% or less otherwise this test wouldn't do any
> system stress at all.

Halving the requested size wouldn't generate the global memory pressure
which seems to be the primary purpose of the test AFAIU.
-- 
Michal Hocko
SUSE Labs


More information about the Ltp mailing list