[LTP] [PATCH 3/4] memcg_lib.sh: Get rid of sleep 1 in signal_memcg_process
Jan Stancek
jstancek@redhat.com
Mon Sep 5 12:18:15 CEST 2016
----- Original Message -----
> From: "Stanislav Kholmanskikh" <stanislav.kholmanskikh@oracle.com>
> To: "Cyril Hrubis" <chrubis@suse.cz>, ltp@lists.linux.it
> Sent: Friday, 2 September, 2016 11:42:00 AM
> Subject: Re: [LTP] [PATCH 3/4] memcg_lib.sh: Get rid of sleep 1 in signal_memcg_process
>
>
> > +
> > kill -s USR1 $pid 2> /dev/null
> > - sleep 1
> > +
> > + if [ -z "$size" ]; then
> > + return
> > + fi
> > +
> > + while kill -0 $pid 2> /dev/null; do
> > + local usage=$(cat ${path}memory.usage_in_bytes)
> > + local diff_a=$((usage_start - usage))
> > + local diff_b=$((usage - usage_start))
> > +
> > + if [ "$diff_a" -ge "$size" -o "$diff_b" -ge "$size" ]; then
> > + return
> > + fi
> > +
> > + tst_sleep 100ms
> > + done
>
> Maybe add some limit on the number of checks? In case the process
> consumes less memory than in $size.
This was my concern as well, in unlikely case it won't get killed,
we could loop here.
Regards,
Jan
More information about the ltp
mailing list