public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Jan Stancek <jstancek@redhat.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH 3/4] memcg_lib.sh: Get rid of sleep 1 in signal_memcg_process
Date: Mon, 5 Sep 2016 06:18:15 -0400 (EDT)	[thread overview]
Message-ID: <1433899610.1780903.1473070695326.JavaMail.zimbra@redhat.com> (raw)
In-Reply-To: <57C94968.5070609@oracle.com>





----- 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

  reply	other threads:[~2016-09-05 10:18 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-01 17:18 [LTP] [PATCH 1/4] memcg_lib.sh: Print test number at test start Cyril Hrubis
2016-09-01 17:18 ` [LTP] [PATCH 2/4] memcg_lib.sh: Move all the kill -s XXX to functions Cyril Hrubis
2016-09-02  9:27   ` Stanislav Kholmanskikh
2016-09-01 17:18 ` [LTP] [PATCH 3/4] memcg_lib.sh: Get rid of sleep 1 in signal_memcg_process Cyril Hrubis
2016-09-02  9:42   ` Stanislav Kholmanskikh
2016-09-05 10:18     ` Jan Stancek [this message]
2016-09-05 12:10       ` Cyril Hrubis
2016-09-05 12:50     ` Cyril Hrubis
2016-09-07 10:19     ` Cyril Hrubis
2016-09-08  8:38       ` Stanislav Kholmanskikh
2016-09-01 17:18 ` [LTP] [PATCH 4/4] memcg_function_test.sh: Split Cyril Hrubis
2016-09-02 10:28   ` Stanislav Kholmanskikh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1433899610.1780903.1473070695326.JavaMail.zimbra@redhat.com \
    --to=jstancek@redhat.com \
    --cc=ltp@lists.linux.it \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox