[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH] scheduler: adjust internal locking interface
On 11/10/13 15:37, Jan Beulich wrote: On 11.10.13 at 16:29, Andrew Cooper <andrew.cooper3@xxxxxxxxxx> 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 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |