[LTP] [PATCH 3/4] memcg_lib.sh: Get rid of sleep 1 in signal_memcg_process

Cyril Hrubis chrubis@suse.cz
Mon Sep 5 14:10:33 CEST 2016


Hi!
> > >  	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.

OK, will add timeout here.

-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list