xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: David Vrabel <david.vrabel@citrix.com>
To: Simon Rowe <simon.rowe@eu.citrix.com>
Cc: xen-devel@lists.xen.org
Subject: Re: [PATCH] xs: set read_thread stacksize
Date: Tue, 29 May 2012 17:39:11 +0100	[thread overview]
Message-ID: <4FC4FBAF.6040503@citrix.com> (raw)
In-Reply-To: <0cf61ed6ce86de2b61db.1338307000@drall.uk.xensource.com>

On 29/05/12 16:56, Simon Rowe wrote:
> xs_watch() creates a thread to wake watchers using default attributes. The
> stacksize can be quite large (8 MB on Linux), applications that link against
> xenstore end up having a larger memory footprint than necessary.
> 
> Signed-off-by: Simon Rowe <simon.rowe@eu.citrix.com>
> 
> diff -r 53e0571f94e4 -r 0cf61ed6ce86 tools/xenstore/xs.c
> --- a/tools/xenstore/xs.c	Fri May 25 08:21:25 2012 +0100
> +++ b/tools/xenstore/xs.c	Tue May 29 16:45:03 2012 +0100
> @@ -705,11 +705,31 @@ bool xs_watch(struct xs_handle *h, const
>  	/* We dynamically create a reader thread on demand. */
>  	mutex_lock(&h->request_mutex);
>  	if (!h->read_thr_exists) {
> +#if _POSIX_THREAD_ATTR_STACKSIZE > 0

This #if seems unnecessary.  pthread_attr_setsetstacksize() doesn't
appear to be an optional.

> +		pthread_attr_t attr;
> +
> +		if (pthread_attr_init(&attr) != 0) {
> +			mutex_unlock(&h->request_mutex);
> +			return false;
> +		}
> +		if (pthread_attr_setstacksize(&attr, 16 * 1024) != 0) {

#define for this value?

David

  reply	other threads:[~2012-05-29 16:39 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-29 15:56 [PATCH] xs: set read_thread stacksize Simon Rowe
2012-05-29 16:39 ` David Vrabel [this message]
2012-05-29 19:39   ` Ian Campbell
2012-05-30  7:56     ` Simon Rowe
2012-05-30  9:40       ` Ian Campbell
2012-05-30 12:10         ` Simon Rowe
2012-05-31  7:32           ` Ian Campbell
2012-06-21  9:09             ` Roger Pau Monne
2012-06-21  9:18               ` Ian Campbell
2012-06-21  9:39                 ` Roger Pau Monne
2012-06-21 10:18                   ` Ian Campbell
2012-06-21 10:27                     ` Roger Pau Monne
2012-06-21 10:32                       ` Ian Campbell
2012-06-21 17:19               ` Ian Jackson

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=4FC4FBAF.6040503@citrix.com \
    --to=david.vrabel@citrix.com \
    --cc=simon.rowe@eu.citrix.com \
    --cc=xen-devel@lists.xen.org \
    /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;
as well as URLs for NNTP newsgroup(s).