[PATCH 1/6] oom: Make find_lock_task_mm() sparse-aware

Anton Vorontsov anton.vorontsov at linaro.org
Mon Feb 6 18:59:09 UTC 2012


On Mon, Feb 06, 2012 at 08:35:42AM -0800, Greg KH wrote:
[...]
> > -extern struct task_struct *find_lock_task_mm(struct task_struct *p);
> > +extern struct task_struct *__find_lock_task_mm(struct task_struct *p);
> > +
> > +#define find_lock_task_mm(p)						\
> > +({									\
> > +	struct task_struct *__ret;					\
> > +									\
> > +	__cond_lock(&(p)->alloc_lock, __ret = __find_lock_task_mm(p));	\
> > +	__ret;								\
> > +})
> 
> Please use the proper "do...while" style thing here for multi-line,
> complex #defines like the rest of the kernel does so that you don't end
> up debugging horrible problems later.

Unfortunately this isn't possible in this case. Unlike '({})' GCC
extension, do-while statement does not evaluate to a value, i.e.
'x = do { 123; } while (0);' is illegal.

Thanks,

-- 
Anton Vorontsov
Email: cbouatmailru at gmail.com



More information about the linaro-kernel mailing list