From mboxrd@z Thu Jan 1 00:00:00 1970 From: George Dunlap Subject: Re: [PATCH] scheduler: adjust internal locking interface Date: Fri, 11 Oct 2013 15:41:34 +0100 Message-ID: <52580E1E.30309@eu.citrix.com> References: <525823DE02000078000FA971@nat28.tlf.novell.com> <52580B45.3080305@citrix.com> <5258294102000078000FA9A2@nat28.tlf.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1VUdug-0000HY-4L for xen-devel@lists.xenproject.org; Fri, 11 Oct 2013 14:41:58 +0000 In-Reply-To: <5258294102000078000FA9A2@nat28.tlf.novell.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: Jan Beulich , Andrew Cooper Cc: xen-devel , Keir Fraser , David Vrabel List-Id: xen-devel@lists.xenproject.org On 11/10/13 15:37, Jan Beulich wrote: >>>> On 11.10.13 at 16:29, Andrew Cooper wrote: >> On 11/10/13 15:14, Jan Beulich wrote: >>> +#define sched_lock(kind, param, cpu, irq, arg...) \ >>> +static inline spinlock_t *kind##_schedule_lock##irq(param EXTRA_TYPE(arg)) >> \ >>> +{ \ >>> + for ( ; ; ) \ >>> + { \ >>> + spinlock_t *lock = per_cpu(schedule_data, cpu).schedule_lock; \ >>> + /* \ >>> + * v->processor may change when grabbing the lock; but \ >>> + * per_cpu(v->processor) may also change, if changing cpu pool \ >>> + * also changes the scheduler lock. Retry until they match. \ >>> + * \ >>> + * It may also be the case that v->processor may change but the \ >>> + * lock may be the same; this will succeed in that case. \ >>> + */ \ >>> + spin_lock##irq(lock, ## arg); \ >>> + if ( likely(lock == per_cpu(schedule_data, cpu).schedule_lock) ) \ >>> + return lock; \ >>> + spin_unlock##irq(lock, ## arg); \ >>> + } \ >>> } >> The readability of this (and others) would be much easier if the '\' >> were aligned on the RHS and out of view of the main body. > This depends on the fonts you use - in a mail reader using variable > width fonts it reads much better the way I coded it. And while I > realized that there are may cases where there is right alignment of > these line continuations, I'm personally not in favor of this style, > and since the coding style document doesn't say anything about it > I used my personal preference... But what we care about is how it looks in an editor. I presume when you're actually coding you use a fixed-width font? :-) -George