From: chrubis@suse.cz
To: DAN LI <li.dan@cn.fujitsu.com>
Cc: LTP list <ltp-list@lists.sourceforge.net>
Subject: Re: [LTP] [PATCH v6] pthread_cond_brodcast/1-2.c hung when mem left is not enough
Date: Mon, 15 Oct 2012 17:21:32 +0200 [thread overview]
Message-ID: <20121015152131.GA4852@rei.suse.cz> (raw)
In-Reply-To: <5077D10C.3040302@cn.fujitsu.com>
Hi!
> +#ifdef __linux__
> +#include <sys/sysinfo.h>
> +
> +static int getfreeram(void)
> +{
> + int ret;
> + struct sysinfo sysinformation;
> +
> + ret = sysinfo(&sysinformation);
> + if (ret != 0)
> + return 0;
> + return sysinformation.freeram;
> +}
> +#else
> +static int getfreeram(void)
> +{
> + return 0;
> +}
> +#endif
I think that there is still the same problem as in the first version.
Are you sure that sysinfo.freeram is reasonable number? Because as far
as I understand it this nuber shows amount of ram that is not used
currently. So when you run the test inside of LTP testsuite the number
may be quite low as there may be a lot of data cached in the buffers
because buffers are flushed only when there is memory pressure.
I've checked docs for both fork() and pthread_create() and both of them
shall indicate that there are no resources to create process/thread by
setting errno to EAGAIN (fork() may additionally return ENOMEM too). So
we could create processes until counter is reached or we got ENOMEM
which should be 100% portable.
--
Cyril Hrubis
chrubis@suse.cz
------------------------------------------------------------------------------
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
prev parent reply other threads:[~2012-10-15 15:23 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-12 8:13 [LTP] [PATCH v6] pthread_cond_brodcast/1-2.c hung when mem left is not enough DAN LI
2012-10-15 15:21 ` chrubis [this message]
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=20121015152131.GA4852@rei.suse.cz \
--to=chrubis@suse.cz \
--cc=li.dan@cn.fujitsu.com \
--cc=ltp-list@lists.sourceforge.net \
/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