From: Benjamin Marzinski <bmarzins@redhat.com>
To: device-mapper development <dm-devel@redhat.com>
Subject: Re: [PATCH 2/3] set pthread stack size to at least PTHREAD_STACK_MIN
Date: Mon, 16 Mar 2009 18:08:47 -0500 [thread overview]
Message-ID: <20090316230847.GM32340@ether.msp.redhat.com> (raw)
In-Reply-To: <49BE7A89.1040808@suse.de>
> On Mon, Mar 16, 2009 at 05:12:57PM +0100, Hannes Reinecke wrote:
>> This approach doesn't doesn't actually fix the bug that I see. The
>> problem I was seeing is that setting the stacksize too small just causes
>> pthread_attr_setstacksize() to fail, leaving you with the default stack
>> size. On some architectures, the default stacksize is large, like 10Mb.
>> Since you start one waiter thread per multipath device, every 100
>> devices eats up 1Gb of memory. Your approach always uses the default
>> stack size, unless it's too small. I've never seen problems with the
>> stack being too small. Only too large. Maybe your experience has been
>> different.
>>
> Me neither. Makes me wonder if we _really_ need to set the stacksize.
> After all, I'm not aware that we're having any excessive stack usage
> somewhere. Maybe we can simplify it by removing the stack attribute
> setting altogether?
>
> I'll see if I can get the different stacksizes and just compare them
> to the 'updated' setting. Maybe there's no big difference after all...
I definitely see a problem if we use the default stacksize on ia64
machines. In RHEL5 at least, it's 10Mb per thread. With one waiter
thread per multipath device, you get a gigabyte of memory wasted on
machines with over a hundred multipath devices.
>> The other problem is that when I actually read the pthread_attr_init man
>> page (it can fail. who knew?), I saw that it can fail with ENOMEM. Also,
>> that it had a function to free it, and that the result of reinitializing
>> an attr that hadn't been freed was undefined. Clearly, this function
>> wasn't intended to be called over and over without ever freeing the
>> attr, which is how we've been using it in multipathd. So, in the spirit
>> of writing code to the interface, instead of to how it appears to be
>> currently implemented, how about this.
> Hmm. You're not freeing the attribute for all non-logging threads neither.
But I only allocate it once.
> Oversight?
Any time a new device is added, we need the waiter thread attribute. I
suppose I could free it after each waiter thread is started, and then
reallocate it again, but it seems like sort of a waste since we want the
same values every time.
I don't explicitly deallocate it on shutdown, but no matter what the
implementation is, I expect it will be cleaned up when multipathd
ends.
Or am I missing something?
-Ben
next prev parent reply other threads:[~2009-03-16 23:08 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-12 18:38 [PATCH 0/3] Some miscellaneous dm-multipath patches Benjamin Marzinski
2009-03-12 18:38 ` [PATCH 1/3] remove deleted path from pathvec Benjamin Marzinski
2009-03-12 18:38 ` [PATCH 2/3] set pthread stack size to at least PTHREAD_STACK_MIN Benjamin Marzinski
2009-03-13 10:51 ` Hannes Reinecke
2009-03-13 20:55 ` Benjamin Marzinski
2009-03-16 16:12 ` Hannes Reinecke
2009-03-16 23:08 ` Benjamin Marzinski [this message]
2009-03-17 7:56 ` Joe Thornber
2009-03-30 23:30 ` Benjamin Marzinski
2009-03-13 11:08 ` Joe Thornber
2009-03-12 18:38 ` [PATCH 3/3] Add options to multipathd to turn off queueing Benjamin Marzinski
2017-04-25 13:38 ` Xose Vazquez Perez
2017-04-25 18:03 ` Benjamin Marzinski
2009-04-03 22:40 ` [PATCH 0/3] Some miscellaneous dm-multipath patches Christophe Varoqui
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=20090316230847.GM32340@ether.msp.redhat.com \
--to=bmarzins@redhat.com \
--cc=dm-devel@redhat.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.