niXforums Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   PreferencesPreferences   Log in to check your private messagesLog in to check your private messages   Log inLog in 
·  nixdoc.net ·  man pages ·  Linux HOWTOs ·  FreeBSD Tips ·  Forums
navigation Forum index » *nix » BSD » FreeBSD » mail-lists » Architecture
Removing limits from malloc(9)
Post new topic   Reply to topic Page 1 of 1 [10 Posts] View previous topic :: View next topic
Author Message
John Baldwin
*nix forums Guru Wannabe


Joined: 27 Mar 2002
Posts: 278

PostPosted: Fri Apr 12, 2002 5:29 pm    Post subject: Re: Removing limits from malloc(9) Reply with quote

On 12-Apr-2002 Garance A Drosihn wrote:
Quote:
At 1:58 AM -0400 4/12/02, Jeff Roberson wrote:
This is more along the lines of what I was looking for. I
don't like the limits but I wasn't sure if anyone found them
to be useful. So far I have heard 2 votes for getting rid
of limits, and no votes for keeping them.

My earlier comment was meant to be a weak vote for the limits.
"weak" in the sense that I would like to keep them, but that
I do not feel very strongly about it. Consider it more like
half-a-vote for them. Even with that, I wouldn't mind if limits
were only available as a malloc option (set via /etc/malloc.conf)
and not done by default.

These are limits for kernel malloc(9), not userland malloc(3).
These two malloc's are entirely unrelated.

--

John Baldwin <jhb@FreeBSD.org> <>< http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve!" - http://www.FreeBSD.org/

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message
Back to top
Garance A Drosihn
*nix forums Guru Wannabe


Joined: 21 Mar 2002
Posts: 190

PostPosted: Fri Apr 12, 2002 4:19 pm    Post subject: Re: Removing limits from malloc(9) Reply with quote

At 1:29 PM -0400 4/12/02, John Baldwin wrote:
Quote:
On 12-Apr-2002 Garance A Drosihn wrote:
At 1:58 AM -0400 4/12/02, Jeff Roberson wrote:
This is more along the lines of what I was looking for. I
don't like the limits but I wasn't sure if anyone found them
to be useful. So far I have heard 2 votes for getting rid
of limits, and no votes for keeping them.

My earlier comment was meant to be a weak vote for the limits.
"weak" in the sense that I would like to keep them, but that
I do not feel very strongly about it. Consider it more like
half-a-vote for them. Even with that, I wouldn't mind if limits
were only available as a malloc option (set via /etc/malloc.conf)
and not done by default.

These are limits for kernel malloc(9), not userland malloc(3).
These two malloc's are entirely unrelated.

Ah. Okay, reduce my vote to 1/10th of a vote for limits... :-)

--
Garance Alistair Drosehn = gad@eclipse.acs.rpi.edu
Senior Systems Programmer or gad@freebsd.org
Rensselaer Polytechnic Institute or drosih@rpi.edu

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message
Back to top
Garance A Drosihn
*nix forums Guru Wannabe


Joined: 21 Mar 2002
Posts: 190

PostPosted: Fri Apr 12, 2002 3:19 pm    Post subject: Re: Removing limits from malloc(9) Reply with quote

At 1:58 AM -0400 4/12/02, Jeff Roberson wrote:
Quote:
This is more along the lines of what I was looking for. I
don't like the limits but I wasn't sure if anyone found them
to be useful. So far I have heard 2 votes for getting rid
of limits, and no votes for keeping them.

My earlier comment was meant to be a weak vote for the limits.
"weak" in the sense that I would like to keep them, but that
I do not feel very strongly about it. Consider it more like
half-a-vote for them. Even with that, I wouldn't mind if limits
were only available as a malloc option (set via /etc/malloc.conf)
and not done by default.

Perhaps just file these comments under "nice ideas to do someday",
and just ignore them for now...

--
Garance Alistair Drosehn = gad@eclipse.acs.rpi.edu
Senior Systems Programmer or gad@freebsd.org
Rensselaer Polytechnic Institute or drosih@rpi.edu

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message
Back to top
Jeff Roberson
*nix forums Guru Wannabe


Joined: 08 Apr 2002
Posts: 107

PostPosted: Fri Apr 12, 2002 5:58 am    Post subject: Re: Removing limits from malloc(9) Reply with quote

On Thu, 11 Apr 2002, Peter Wemm wrote:

Quote:
Personally, I'd be happy with counts being done per-cpu (to avoid
contention) and aggregated periodically (eg: at vmstat -m time). And to
hell with the limits. But that's just me. :-)


This is more along the lines of what I was looking for. I don't like the
limits but I wasn't sure if anyone found them to be useful. So far I have
heard 2 votes for getting rid of limits, and no votes for keeping them.

Would anyone else care to vote?

Thanks,
Jeff


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message
Back to top
Peter Wemm
*nix forums Guru Wannabe


Joined: 11 Apr 2002
Posts: 113

PostPosted: Thu Apr 11, 2002 9:02 am    Post subject: Re: Removing limits from malloc(9) Reply with quote

Wes Peters wrote:
Quote:
Dag-Erling Smorgrav wrote:

Jeff Roberson <jroberson@chesapeake.net> writes:
The last bit that is missing before we can call malloc/free w/o Giant is
the malloc_type statistics. Currently there is nothing really protecting
them. There really is no lock that they can conveniently live under. I
have a few options. The one that I'm leaning towards is only enabling
malloc_type statistics if INVARIANTS is compiled in. Then I could make
one lock per malloc_type. The reason this shouldn't be the default is
because it creates a single point of contention which is in sharp contras
t
with the rest of the allocator.

It's still a lot better than Giant, and it's a leaf lock so there
shouldn't be any worries about reversal. I'd go for it if I were you.

Can they be updated with an atomic increment? For statistics like this,
being off by 1 or 2 on read isn't so important as long as you don't miss
a bunch of counts.

You know, at work the one and only time we ever check malloc limits is when
we discover that a transient load spike caused it to hit some limit and it
crashed or locked up as a result. When the machine crashes or deadlocks
automatically as a result of hitting the limits, one has to wonder what the
point is? It is crashing in order to protect us from what? crashing?

Personally, I'd be happy with counts being done per-cpu (to avoid
contention) and aggregated periodically (eg: at vmstat -m time). And to
hell with the limits. But that's just me. :-)

Cheers,
-Peter
--
Peter Wemm - peter@wemm.org; peter@FreeBSD.org; peter@yahoo-inc.com
"All of this is for nothing if we don't go to the stars" - JMS/B5


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message
Back to top
Jeff Roberson
*nix forums Guru Wannabe


Joined: 08 Apr 2002
Posts: 107

PostPosted: Wed Apr 10, 2002 9:18 am    Post subject: Re: Removing limits from malloc(9) Reply with quote

On Tue, 9 Apr 2002, Wes Peters wrote:

Quote:
Dag-Erling Smorgrav wrote:

It's still a lot better than Giant, and it's a leaf lock so there
shouldn't be any worries about reversal. I'd go for it if I were you.

Can they be updated with an atomic increment? For statistics like this,
being off by 1 or 2 on read isn't so important as long as you don't miss
a bunch of counts.


An atomic increment would still cause cache thrashing. I considered doing
per cpu queues for the statistics and then aggregating them when someone
wants to report them. This doesn't work if you want to do limits though,
since you'd need to check all of the statistics caches at each call. I
suppose that this is really good enough at this point. Maybe when we're
running on 64 or 128 CPU systems the cache thrashing will hurt enough to
get rid of limits. Smile Until then I'll just leave them the way they are
and wrap the whole thing in a per malloc_type mutex. This should
sufficiently reduce contention and make malloc(9) totally mp safe.

Jeff


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message
Back to top
Wes Peters
*nix forums addict


Joined: 09 Apr 2002
Posts: 90

PostPosted: Tue Apr 09, 2002 9:56 pm    Post subject: Re: Removing limits from malloc(9) Reply with quote

Dag-Erling Smorgrav wrote:
Quote:

Jeff Roberson <jroberson@chesapeake.net> writes:
The last bit that is missing before we can call malloc/free w/o Giant is
the malloc_type statistics. Currently there is nothing really protecting
them. There really is no lock that they can conveniently live under. I
have a few options. The one that I'm leaning towards is only enabling
malloc_type statistics if INVARIANTS is compiled in. Then I could make
one lock per malloc_type. The reason this shouldn't be the default is
because it creates a single point of contention which is in sharp contrast
with the rest of the allocator.

It's still a lot better than Giant, and it's a leaf lock so there
shouldn't be any worries about reversal. I'd go for it if I were you.

Can they be updated with an atomic increment? For statistics like this,
being off by 1 or 2 on read isn't so important as long as you don't miss
a bunch of counts.

--
"Where am I, and what am I doing in this handbasket?"

Wes Peters Softweyr LLC
wes@softweyr.com http://softweyr.com/

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message
Back to top
Garance A Drosihn
*nix forums Guru Wannabe


Joined: 21 Mar 2002
Posts: 190

PostPosted: Mon Apr 08, 2002 7:37 pm    Post subject: Re: Removing limits from malloc(9) Reply with quote

At 4:25 AM -0400 4/8/02, Jeff Roberson wrote:
Quote:
The last bit that is missing before we can call malloc/free w/o
Giant is the malloc_type statistics. [...] I have a few options.
The one that I'm leaning towards is only enabling malloc_type
statistics if INVARIANTS is compiled in. Then I could make one
lock per malloc_type.

Why would this be tied to INVARIANTS? That option is described
as "enable sanity checks". Would it make more sense to have a
different kernel option, called MALLOC_STATS or something? Maybe
have that as a sysctl, or at least a loader-tunable value?

or maybe even an /etc/malloc.conf option...

Quote:
So, the INVARIANTS only option doesn't work if we want to keep
malloc type limits. I'm wondering how useful this has been in
the past? I have heard from phk that it is useful for md(4)
which could be converted to use a zone. Is there any real need
for these limits other than that?

I would like the option of malloc type limits to remain available,
although it would be alright if it's only available as some option.

I have a feeling that there is something about this that I'm
missing, though...

--
Garance Alistair Drosehn = gad@eclipse.acs.rpi.edu
Senior Systems Programmer or gad@freebsd.org
Rensselaer Polytechnic Institute or drosih@rpi.edu

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message
Back to top
Dag-Erling Smorgrav
*nix forums Guru Wannabe


Joined: 23 Mar 2002
Posts: 110

PostPosted: Mon Apr 08, 2002 8:25 am    Post subject: Re: Removing limits from malloc(9) Reply with quote

Jeff Roberson <jroberson@chesapeake.net> writes:
Quote:
The last bit that is missing before we can call malloc/free w/o Giant is
the malloc_type statistics. Currently there is nothing really protecting
them. There really is no lock that they can conveniently live under. I
have a few options. The one that I'm leaning towards is only enabling
malloc_type statistics if INVARIANTS is compiled in. Then I could make
one lock per malloc_type. The reason this shouldn't be the default is
because it creates a single point of contention which is in sharp contrast
with the rest of the allocator.

It's still a lot better than Giant, and it's a leaf lock so there
shouldn't be any worries about reversal. I'd go for it if I were you.

DES
--
Dag-Erling Smorgrav - des@ofug.org

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message
Back to top
Jeff Roberson
*nix forums Guru Wannabe


Joined: 08 Apr 2002
Posts: 107

PostPosted: Mon Apr 08, 2002 8:25 am    Post subject: Removing limits from malloc(9) Reply with quote

The last bit that is missing before we can call malloc/free w/o Giant is
the malloc_type statistics. Currently there is nothing really protecting
them. There really is no lock that they can conveniently live under. I
have a few options. The one that I'm leaning towards is only enabling
malloc_type statistics if INVARIANTS is compiled in. Then I could make
one lock per malloc_type. The reason this shouldn't be the default is
because it creates a single point of contention which is in sharp contrast
with the rest of the allocator.

So, the INVARIANTS only option doesn't work if we want to keep malloc type
limits. I'm wondering how useful this has been in the past? I have heard
from phk that it is useful for md(4) which could be converted to use a
zone. Is there any real need for these limits other than that?

Any comments? Suggestions?

Thanks!
Jeff


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message
Back to top
Google

Back to top
Display posts from previous:   
Post new topic   Reply to topic Page 1 of 1 [10 Posts] View previous topic :: View next topic
The time now is Thu Jan 08, 2009 5:12 am | All times are GMT
navigation Forum index » *nix » BSD » FreeBSD » mail-lists » Architecture
Jump to:  

Similar Topics
Topic Author Forum Replies Last Post
No new posts Removing db from environment mike.klaas@gmail.com Berkeley DB 0 Fri Jul 21, 2006 5:14 am
No new posts Help Needed. Removing a Folder Problem Kilicaslan Fatih python 4 Thu Jul 20, 2006 9:57 am
No new posts newbie question on malloc.. dnucit@gmail.com C 9 Tue Jul 18, 2006 9:59 am
No new posts WARNING - current temperature (60.0C) exceeds safe limits renchao85@gmail.com FreeBSD 1 Tue Jul 18, 2006 12:23 am
No new posts Removing static routes PC Datasheet AIX 3 Mon Jul 17, 2006 9:41 am

Secured Loans | Xbox Mod Chips | Actress | Debt Consolidation | Debt Consolidation
Copyright © 2004-2005 DeniX Solutions SRL
 
Other DeniX Solutions sites: Unix/Linux blog |  electronics forum |  medicine forum |  science forum | 
Privacy Policy


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.2231s ][ Queries: 20 (0.1077s) ][ GZIP on - Debug on ]