From: Peter Zijlstra <peterz@infradead.org> To: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Cc: Andi Kleen <andi@firstfloor.org>, Huang Ying <ying.huang@intel.com>, Andrew Morton <akpm@linux-foundation.org>, linux-kernel@vger.kernel.org Subject: Re: [PATCH 8/5] llist: Remove cpu_relax() usage in cmpxchg loops Date: Mon, 12 Sep 2011 17:09:04 +0200 [thread overview] Message-ID: <1315840144.26517.66.camel@twins> (raw) In-Reply-To: <20110912144706.GA21716@Krystal> On Mon, 2011-09-12 at 10:47 -0400, Mathieu Desnoyers wrote: > * Andi Kleen (andi@firstfloor.org) wrote: > > On Mon, Sep 12, 2011 at 04:05:58PM +0200, Peter Zijlstra wrote: > > > Subject: llist: Remove cpu_relax() usage in cmpxchg loops > > > From: Peter Zijlstra <a.p.zijlstra@chello.nl> > > > Date: Mon Sep 12 15:50:49 CEST 2011 > > > > > > Initial benchmarks show they're a net loss (2 socket wsm): > > > > > > > May still save power. > > Looking at kernel/spinlock.c: > > void __lockfunc __raw_##op##_lock(locktype##_t *lock) \ > { > [...] > while (!raw_##op##_can_lock(lock) && (lock)->break_lock)\ > arch_##op##_relax(&lock->raw_lock); \ > > so basically, in typical locking primitives (spinlock), it looks like > lower power consumption is preferred over getting the raw maximal > performance in fully contented scenarios. Who says its about power consumption? That was a baseless claim made by Andi which you propagate as a truth. Typically PAUSE is too short to really save any power and the only gain of having it in loops is to provide a window where another core on the cache domain can have a go. If power consumption would be the prime concern Intel should fix their damn mwait implementation so we can use that for locks. Local spinners + mwait would give a very power efficient 'spin'-lock. > So what is the rationale for making those lock-less lists retry scheme > different from spinlocks here ? PAUSE should help on the medium contended case (it would be pointless on heavy contention), but hurt the lightly contended case. We have all kinds of contention spinlocks in the kernel, but we don't as of yet have very contended llist users in the kernel. Furthermore, I would argue we should avoid growing them, significantly contended atomic ops are bad, use a different scheme.
next prev parent reply other threads:[~2011-09-12 15:09 UTC|newest] Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top 2011-09-08 6:00 [PATCH -mm -v2 0/5] irq_work, Use llist in irq_work Huang Ying 2011-09-08 6:00 ` [PATCH -mm -v2 1/5] llist, Make all llist functions inline Huang Ying 2011-09-08 6:00 ` [PATCH -mm -v2 2/5] llist, Define macro to check NMI safe cmpxchg Huang Ying 2011-09-08 6:00 ` [PATCH -mm -v2 3/5] llist, Move cpu_relax after cmpxchg Huang Ying 2011-09-08 6:00 ` [PATCH -mm -v2 4/5] llist, Return whether list is empty before adding in llist_add Huang Ying 2011-09-08 6:00 ` [PATCH -mm -v2 5/5] irq_work, Use llist in irq_work Huang Ying 2011-09-12 14:05 ` [PATCH 6/5] llist: Add llist_next() Peter Zijlstra 2011-09-12 14:05 ` [PATCH 7/5] sched: Convert to use llist Peter Zijlstra 2011-09-12 14:05 ` [PATCH 8/5] llist: Remove cpu_relax() usage in cmpxchg loops Peter Zijlstra 2011-09-12 14:23 ` Andi Kleen 2011-09-12 14:23 ` Peter Zijlstra 2011-09-12 14:47 ` Mathieu Desnoyers 2011-09-12 15:09 ` Peter Zijlstra [this message] 2011-09-12 15:24 ` Peter Zijlstra 2011-09-12 16:38 ` Andi Kleen 2011-09-12 18:53 ` Peter Zijlstra 2011-09-12 14:26 ` Avi Kivity 2011-09-12 14:32 ` Peter Zijlstra 2011-09-13 11:43 ` Avi Kivity 2011-09-13 14:22 ` Peter Zijlstra 2011-09-13 14:51 ` Avi Kivity 2011-09-13 14:53 ` Peter Zijlstra 2011-09-12 14:06 ` [PATCH -mm -v2 0/5] irq_work, Use llist in irq_work Peter Zijlstra
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=1315840144.26517.66.camel@twins \ --to=peterz@infradead.org \ --cc=akpm@linux-foundation.org \ --cc=andi@firstfloor.org \ --cc=linux-kernel@vger.kernel.org \ --cc=mathieu.desnoyers@efficios.com \ --cc=ying.huang@intel.com \ --subject='Re: [PATCH 8/5] llist: Remove cpu_relax() usage in cmpxchg loops' \ /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
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.