From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ian Campbell Subject: Re: [PATCH] xs: set read_thread stacksize Date: Tue, 29 May 2012 20:39:33 +0100 Message-ID: <1338320373.21683.22.camel@dagon.hellion.org.uk> References: <0cf61ed6ce86de2b61db.1338307000@drall.uk.xensource.com> <4FC4FBAF.6040503@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <4FC4FBAF.6040503@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: David Vrabel Cc: Simon Rowe , "xen-devel@lists.xen.org" List-Id: xen-devel@lists.xenproject.org On Tue, 2012-05-29 at 17:39 +0100, David Vrabel wrote: > 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 > > > > 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. ...and if it were then autoconf is the way to figure that out now, unless _POSIX_THREAD_ATTR_STACKSIZE is specified somewhere (which I doubt). Also if it is only pthread_attr_setstacksize which is optional, rather than pthread_attr_* generally, then the #if could be pulled into just surround that call, presuming there is no harm in a "NULL" attr. > > + 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? Yes, please. Ian. > > David > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xen.org > http://lists.xen.org/xen-devel