Re: [PATCH -v7][RFC]: mutex: implement adaptive spinning

2009-01-08 Thread Andi Kleen
> foo() > { > char a[1000]; > } > > bar() > { > char a[1000]; > } > > zot() > { > foo(); > bar(); > } > > uses 2000 bytes of stack. > And with the right compiler version. I believe that's fixed in newer gcc versions. For old gccs we might indeed need to add noinlines th

Re: [PATCH -v7][RFC]: mutex: implement adaptive spinning

2009-01-08 Thread Andi Kleen
On Thu, Jan 08, 2009 at 07:42:48PM -0800, Linus Torvalds wrote: > > I actually often use noinline when developing code simply because it > > makes it easier to read oopses when gcc doesn't inline ever static > > (which it normally does if it only has a single caller) > > Yes. Gcc inlining is a to

Re: [PATCH -v7][RFC]: mutex: implement adaptive spinning

2009-01-08 Thread Andrew Morton
On Fri, 9 Jan 2009 04:35:31 +0100 Andi Kleen wrote: > On Thu, Jan 08, 2009 at 05:44:25PM -0800, H. Peter Anvin wrote: > > Harvey Harrison wrote: > > >> > > >> We might still try the second or third options, as i think we shouldnt > > >> go > > >> back into the business of managing the inline at

Re: [PATCH -v7][RFC]: mutex: implement adaptive spinning

2009-01-08 Thread H. Peter Anvin
Harvey Harrison wrote: > > A lot of code was written assuming inline means __always_inline, I'd suggest > keeping that assumption and working on removing inlines that aren't > strictly necessary as there's no way to know what inlines meant 'try to > inline' > and what ones really should have been

Re: [PATCH -v7][RFC]: mutex: implement adaptive spinning

2009-01-08 Thread H. Peter Anvin
Linus Torvalds wrote: > > First off, gcc _does_ have a perfectly fine notion of how heavy-weight an > "asm" statement is: just count it as a single instruction (and count the > argument setup cost that gcc _can_ estimate). > True. It's not what it's doing, though. It looks for '\n' and ';' c

Re: [PATCH -v7][RFC]: mutex: implement adaptive spinning

2009-01-08 Thread David Miller
From: Linus Torvalds Date: Thu, 8 Jan 2009 19:46:30 -0800 (PST) > First off, gcc _does_ have a perfectly fine notion of how heavy-weight an > "asm" statement is: just count it as a single instruction (and count the > argument setup cost that gcc _can_ estimate). Actually, at least at one point

Re: [PATCH -v7][RFC]: mutex: implement adaptive spinning

2009-01-08 Thread Linus Torvalds
On Thu, 8 Jan 2009, H. Peter Anvin wrote: > > Right. gcc simply doesn't have any way to know how heavyweight an > asm() statement is I don't think that's relevant. First off, gcc _does_ have a perfectly fine notion of how heavy-weight an "asm" statement is: just count it as a single instruc

Re: [PATCH -v7][RFC]: mutex: implement adaptive spinning

2009-01-08 Thread Linus Torvalds
On Fri, 9 Jan 2009, Andi Kleen wrote: > > I actually often use noinline when developing code simply because it > makes it easier to read oopses when gcc doesn't inline ever static > (which it normally does if it only has a single caller) Yes. Gcc inlining is a total piece of sh*t. Gcc doesn't

Re: [PATCH -v7][RFC]: mutex: implement adaptive spinning

2009-01-08 Thread Andi Kleen
On Thu, Jan 08, 2009 at 05:44:25PM -0800, H. Peter Anvin wrote: > Harvey Harrison wrote: > >> > >> We might still try the second or third options, as i think we shouldnt go > >> back into the business of managing the inline attributes of ~100,000 > >> kernel functions. > > > > Or just make it cl

Re: What's wrong with snapshot?

2009-01-08 Thread Shen Feng
thanks. I got it. Shen on 01/08/2009 07:49 PM, Yan Zheng wrote: > 2009/1/8 Shen Feng : >> Hello, >> >> I tried to ceate a snapshot of a subvol. >> But it seems now work. >> >> Please see the test below. I think the file created by dd >> should also in the snap directory. >> > > This is the expec

Re: [PATCH -v7][RFC]: mutex: implement adaptive spinning

2009-01-08 Thread Harvey Harrison
On Thu, 2009-01-08 at 17:44 -0800, H. Peter Anvin wrote: > Harvey Harrison wrote: > >> > >> We might still try the second or third options, as i think we shouldnt go > >> back into the business of managing the inline attributes of ~100,000 > >> kernel functions. > > > > Or just make it clear tha

Re: [PATCH -v7][RFC]: mutex: implement adaptive spinning

2009-01-08 Thread H. Peter Anvin
Harvey Harrison wrote: >> >> We might still try the second or third options, as i think we shouldnt go >> back into the business of managing the inline attributes of ~100,000 >> kernel functions. > > Or just make it clear that inline shouldn't (unless for a very good reason) > _ever_ be used in

Re: [PATCH -v7][RFC]: mutex: implement adaptive spinning

2009-01-08 Thread H. Peter Anvin
Andi Kleen wrote: >> I'll try to annotate the inline asms (there's not _that_ many of them), >> and measure what the size impact is. > > You can just use the patch I submitted and that you rejected for > most of them :) I just ran a sample build for x86-64 with gcc 4.3.0, these all allyesconfig

Re: Btrfs for mainline

2009-01-08 Thread jim owens
Chris Mason wrote: Unresolved from this reviewing thread: * Should it be named btrfsdev? My vote is no, it is extra work for the distros when we finally do rename it, and I don't think btrfs really has the reputation for stability right now. But if Linus or Andrew would prefer the dev on ther

Re: [PATCH -v7][RFC]: mutex: implement adaptive spinning

2009-01-08 Thread Steven Rostedt
> > The problem? Setting "lock->count" to 0. That will mean that the next > "mutex_unlock()" will not necessarily enter the slowpath at all, and won't > necessarily wake things up like it should. > > Normally we set lock->count to 0 after getting the lock, and only _inside_ > the spinlock, an

Re: [PATCH -v7][RFC]: mutex: implement adaptive spinning

2009-01-08 Thread Harvey Harrison
On Thu, 2009-01-08 at 19:33 +0100, Ingo Molnar wrote: > * Linus Torvalds wrote: > > > > Ingo - I think we need to remove that crap again. Because gcc gets the > > inlining horribly horribly wrong. As usual. > > Apparently it messes up with asm()s: it doesnt know the contents of the > asm()

Re: [PATCH -v7][RFC]: mutex: implement adaptive spinning

2009-01-08 Thread Linus Torvalds
On Thu, 8 Jan 2009, Chris Mason wrote: > > The patch below isn't quite what Linus suggested, but it is working here > at least. In every test I've tried so far, this is faster than the ugly > btrfs spin. Sadly, I don't think it's really working. I was pretty sure that adding the unlocked loop

Re: [PATCH -v7][RFC]: mutex: implement adaptive spinning

2009-01-08 Thread Steven Rostedt
On Thu, 8 Jan 2009, Chris Mason wrote: > On Thu, 2009-01-08 at 13:14 -0500, Steven Rostedt wrote: > > > > If it was the current process that preempted the owner and these are RT > > tasks pinned to the same CPU and the owner is of lower priority than the > > spinner, we have a deadlock! > > >

Re: [PATCH -v7][RFC]: mutex: implement adaptive spinning

2009-01-08 Thread Peter Zijlstra
On Thu, 2009-01-08 at 11:13 -0800, Linus Torvalds wrote: > > Well, at least we do unless you enable that broken paravirt support. I'm > not at all clear on why CONFIG_PARAVIRT wants to use inferior locks, but I > don't much care. Because the virtual cpu that has the ticket might not get schedul

Re: [PATCH -v7][RFC]: mutex: implement adaptive spinning

2009-01-08 Thread Chris Mason
On Thu, 2009-01-08 at 13:14 -0500, Steven Rostedt wrote: > > > On Thu, 8 Jan 2009, Steven Rostedt wrote: > > > In fact, you might not even need a process C: all you need is for B to be > > > on the same runqueue as A, and having enough load on the other CPU's that > > > A never gets migrated aw

Re: [PATCH -v7][RFC]: mutex: implement adaptive spinning

2009-01-08 Thread Linus Torvalds
On Thu, 8 Jan 2009, Chris Mason wrote: > > It is less fair though, the 50 proc parallel creates had a much bigger > span between the first and last proc's exit time. This isn't a huge > shock, I think it shows the hot path is closer to a real spin lock. Actually, the real spin locks are now fa

Re: [PATCH -v7][RFC]: mutex: implement adaptive spinning

2009-01-08 Thread Chris Mason
On Thu, 2009-01-08 at 13:27 -0500, Chris Mason wrote: > On Thu, 2009-01-08 at 10:16 -0800, Linus Torvalds wrote: > > > > On Thu, 8 Jan 2009, Steven Rostedt wrote: > > > > > > Ouch! I think you are on to something: > > > > Yeah, there's somethign there, but looking at Chris' backtrace, there's >

Re: [PATCH -v7][RFC]: mutex: implement adaptive spinning

2009-01-08 Thread Andi Kleen
> I'll try to annotate the inline asms (there's not _that_ many of them), > and measure what the size impact is. You can just use the patch I submitted and that you rejected for most of them :) -Andi -- a...@linux.intel.com -- To unsubscribe from this list: send the line "unsubscribe linux-btr

Re: [PATCH -v7][RFC]: mutex: implement adaptive spinning

2009-01-08 Thread H. Peter Anvin
Ingo Molnar wrote: > > Apparently it messes up with asm()s: it doesnt know the contents of the > asm() and hence it over-estimates the size [based on string heuristics] > ... > Right. gcc simply doesn't have any way to know how heavyweight an asm() statement is, and it WILL do the wrong thin

Re: [PATCH -v7][RFC]: mutex: implement adaptive spinning

2009-01-08 Thread Ingo Molnar
* Linus Torvalds wrote: > Unrelated: > > On Thu, 8 Jan 2009, Chris Mason wrote: > > > > RIP: 0010:[] [] __cmpxchg+0x36/0x3f > > Ouch. HOW THE HELL DID THAT NOT GET INLINED? > > cmpxchg() is a _single_ instruction if it's inlined, but it's a horrible > mess of dynamic conditionals on the (co

Re: [PATCH -v7][RFC]: mutex: implement adaptive spinning

2009-01-08 Thread Chris Mason
On Thu, 2009-01-08 at 10:16 -0800, Linus Torvalds wrote: > > On Thu, 8 Jan 2009, Steven Rostedt wrote: > > > > Ouch! I think you are on to something: > > Yeah, there's somethign there, but looking at Chris' backtrace, there's > nothing there to disable preemption. So if it was this simple case,

Re: [PATCH -v7][RFC]: mutex: implement adaptive spinning

2009-01-08 Thread Linus Torvalds
On Thu, 8 Jan 2009, Steven Rostedt wrote: > > Ouch! I think you are on to something: Yeah, there's somethign there, but looking at Chris' backtrace, there's nothing there to disable preemption. So if it was this simple case, it should still have preempted him to let the other process run and

Re: [PATCH -v7][RFC]: mutex: implement adaptive spinning

2009-01-08 Thread Steven Rostedt
On Thu, 8 Jan 2009, Steven Rostedt wrote: > > In fact, you might not even need a process C: all you need is for B to be > > on the same runqueue as A, and having enough load on the other CPU's that > > A never gets migrated away. So "C" might be in user space. You're right about not needing p

Re: [PATCH -v7][RFC]: mutex: implement adaptive spinning

2009-01-08 Thread Steven Rostedt
On Thu, 8 Jan 2009, Linus Torvalds wrote: > > And I don't even believe that is the bug. I suspect the bug is simpler. > > I think the "need_resched()" needs to go in the outer loop, or at least > happen in the "!owner" case. Because at least with preemption, what can > happen otherwise is >

Re: [PATCH -v7][RFC]: mutex: implement adaptive spinning

2009-01-08 Thread Linus Torvalds
Unrelated: On Thu, 8 Jan 2009, Chris Mason wrote: > > RIP: 0010:[] [] __cmpxchg+0x36/0x3f Ouch. HOW THE HELL DID THAT NOT GET INLINED? cmpxchg() is a _single_ instruction if it's inlined, but it's a horrible mess of dynamic conditionals on the (constant - per call-site) size argument if it

Re: [PATCH -v7][RFC]: mutex: implement adaptive spinning

2009-01-08 Thread Linus Torvalds
On Thu, 8 Jan 2009, Steven Rostedt wrote: > > We keep spinning if the owner changes. I think we want to - if you have multiple CPU's and a heavily contended lock that acts as a spinlock, we still _do_ want to keep spinning even if another CPU gets the lock. And I don't even believe that is t

Re: [PATCH -v7][RFC]: mutex: implement adaptive spinning

2009-01-08 Thread Steven Rostedt
On Thu, 8 Jan 2009, Chris Mason wrote: > On Thu, 2009-01-08 at 08:58 -0800, Linus Torvalds wrote: > > > > Ok, I've gone through -v7, and I'm sure you're all shocked to hear it, but > > I have no complaints. Except that you dropped all the good commit > > commentary you had earlier ;) > > > >

Re: [PATCH -v7][RFC]: mutex: implement adaptive spinning

2009-01-08 Thread Peter Zijlstra
On Thu, 2009-01-08 at 08:58 -0800, Linus Torvalds wrote: > > Ok, I've gone through -v7, and I'm sure you're all shocked to hear it, but > I have no complaints. *cheer*, except I guess we need to figure out what goes bad for Chris. > Except that you dropped all the good commit > commentary you

Re: [PATCH -v7][RFC]: mutex: implement adaptive spinning

2009-01-08 Thread Chris Mason
On Thu, 2009-01-08 at 08:58 -0800, Linus Torvalds wrote: > > Ok, I've gone through -v7, and I'm sure you're all shocked to hear it, but > I have no complaints. Except that you dropped all the good commit > commentary you had earlier ;) > Seems to get stuck under load. I've hit it with make -j

Re: [PATCH -v7][RFC]: mutex: implement adaptive spinning

2009-01-08 Thread Linus Torvalds
Ok, I've gone through -v7, and I'm sure you're all shocked to hear it, but I have no complaints. Except that you dropped all the good commit commentary you had earlier ;) The patch looks pretty good (except for the big "#if 0" block in mutex-debug.c that I hope gets fixed, but I can't even re

[PATCH] Btrfs: warn user that this release is experimental

2009-01-08 Thread jim owens
Post wiki pointer message for getting version status, limitations, and known problems. Signed-off-by: jim owens --- mkfs.c |3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/mkfs.c b/mkfs.c index cb21db6..d664254 100644 --- a/mkfs.c +++ b/mkfs.c @@ -403,6 +403,9 @@ int

Re: [PATCH -v7][RFC]: mutex: implement adaptive spinning

2009-01-08 Thread Linus Torvalds
On Thu, 8 Jan 2009, Peter Zijlstra wrote: > > This was done because the interaction between trylock_slowpath and that > -1000 state hurt my head. Yeah, it was a stupid hacky thing to avoid the "list_empty()", but doing it explicitly is fine (we don't hold the lock, so the list isn't necessari

Re: [PATCH -v7][RFC]: mutex: implement adaptive spinning

2009-01-08 Thread Steven Rostedt
On Thu, 8 Jan 2009, Steven Rostedt wrote: > > > > + /* > > > > +* We need to validate that we can do a > > > > +* get_cpu() and that we have the percpu area. > > > > +*/ > > > > + if (!cpu_online(cpu)) > > > > + goto out; > > > > > > Should we nee

Re: [PATCH -v7][RFC]: mutex: implement adaptive spinning

2009-01-08 Thread Peter Zijlstra
On Thu, 2009-01-08 at 10:28 -0500, Steven Rostedt wrote: > On Thu, 8 Jan 2009, Peter Zijlstra wrote: > > in the unlikely case we schedule(), that seems expensive enough to want > > to make the spin case ever so slightly faster. > > OK, that makes sense, but I would comment that. Otherwise, it jus

Re: [PATCH -v7][RFC]: mutex: implement adaptive spinning

2009-01-08 Thread Steven Rostedt
On Thu, 8 Jan 2009, Peter Zijlstra wrote: > On Thu, 2009-01-08 at 10:09 -0500, Steven Rostedt wrote: > > On Thu, 8 Jan 2009, Peter Zijlstra wrote: > > > Index: linux-2.6/kernel/sched.c > > > === > > > --- linux-2.6.orig/kernel/sched.

Re: [PATCH -v7][RFC]: mutex: implement adaptive spinning

2009-01-08 Thread Peter Zijlstra
On Thu, 2009-01-08 at 10:09 -0500, Steven Rostedt wrote: > On Thu, 8 Jan 2009, Peter Zijlstra wrote: > > Index: linux-2.6/kernel/sched.c > > === > > --- linux-2.6.orig/kernel/sched.c > > +++ linux-2.6/kernel/sched.c > > @@ -4672,6 +467

Re: [PATCH -v7][RFC]: mutex: implement adaptive spinning

2009-01-08 Thread Steven Rostedt
On Thu, 8 Jan 2009, Peter Zijlstra wrote: > Index: linux-2.6/kernel/sched.c > === > --- linux-2.6.orig/kernel/sched.c > +++ linux-2.6/kernel/sched.c > @@ -4672,6 +4672,72 @@ need_resched_nonpreemptible: > } > EXPORT_SYMBOL(schedule)

[PATCH -v7][RFC]: mutex: implement adaptive spinning

2009-01-08 Thread Peter Zijlstra
On Thu, 2009-01-08 at 15:18 +0100, Ingo Molnar wrote: > [ A detail, -tip testing found that the patch breaks mutex debugging: > > = > [ BUG: bad unlock balance detected! ] > - > swapper/0 is trying to release lock (cp

Re: [PATCH -v5][RFC]: mutex: implement adaptive spinning

2009-01-08 Thread Andi Kleen
> Sure, it probably is a non issue, but I'm afraid that non issues of today > might become issues of tomorrow. Where does it say that we can never put a > task struct in a movable zone. Task structs are not movable, so they by definition do not belong in movable zones. > memory local to it, and

Re: [PATCH -v6][RFC]: mutex: implement adaptive spinning

2009-01-08 Thread Gregory Haskins
Ingo Molnar wrote: > * Peter Zijlstra wrote: > > >> * WOW * >> > > WOW indeed - and i can see a similar _brutal_ speedup on two separate > 16-way boxes as well: > > 16 CPUs, running 128 parallel test-tasks. > > NO_OWNER_SPIN: > avg ops/sec: 281595 > > OWNER_SPIN: >

Re: [PATCH -v5][RFC]: mutex: implement adaptive spinning

2009-01-08 Thread Steven Rostedt
On Thu, 8 Jan 2009, Andi Kleen wrote: > > What about memory hotplug as Ingo mentioned? > > > > Should that be: > > > > #if defined(CONFIG_DEBUG_PAGEALLOC) || defined(CONFIG_MEMORY_HOTPLUG) > > We expect memory hotunplug to only really work in movable zones > (all others should at least have on

Re: [PATCH -v6][RFC]: mutex: implement adaptive spinning

2009-01-08 Thread Ingo Molnar
* Peter Zijlstra wrote: > On Wed, 2009-01-07 at 15:10 -0800, Linus Torvalds wrote: > > > Please take all my patches to be pseudo-code. They've neither been > > compiled nor tested, and I'm just posting them in the hope that somebody > > else will then do things in the direction I think is the

Re: What's wrong with snapshot?

2009-01-08 Thread Yan Zheng
2009/1/8 Shen Feng : > Hello, > > I tried to ceate a snapshot of a subvol. > But it seems now work. > > Please see the test below. I think the file created by dd > should also in the snap directory. > This is the expected behaviour. Following link describes what snapshot is. http://en.wikipedia.

[PATCH -v6][RFC]: mutex: implement adaptive spinning

2009-01-08 Thread Peter Zijlstra
On Wed, 2009-01-07 at 15:10 -0800, Linus Torvalds wrote: > Please take all my patches to be pseudo-code. They've neither been > compiled nor tested, and I'm just posting them in the hope that somebody > else will then do things in the direction I think is the proper one ;) Linux opteron 2.6.28-

What's wrong with snapshot?

2009-01-08 Thread Shen Feng
Hello, I tried to ceate a snapshot of a subvol. But it seems now work. Please see the test below. I think the file created by dd should also in the snap directory. [r...@localhost mnt]# ./test2.sh + mkfs.btrfs /dev/sdb8 fs created label (null) on /dev/sdb8 nodesize 4096 leafsize 4096 s