lkml.org 
[lkml]   [2008]   [Apr]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [-mm] Add an owner to the mm_struct (v7)
On Thu, Apr 3, 2008 at 11:51 AM, Balbir Singh <balbir@linux.vnet.ibm.com> wrote:
> >> + * delay_group_leader() ensures that if the group leader is around
> >> + * we need not select a new owner.
> >> + */
> >> + ret = (mm && (atomic_read(&mm->mm_users) > 1) && (mm->owner == p) &&
> >> + !delay_group_leader(p));
> >> + return ret;
> >> +}
> >
> > Ugh. Could you please spell this out a bit more. I find that stuff
> > above really hard to read. Something like:
> >
> > if (!mm)
> > return 0;
> > if (atomic_read(&mm->mm_users) <= 1)
> > return 0;
> > if (mm->owner != p)
> > return 0;
> > if (delay_group_leader(p))
> > return 0;
> > return 1;
> >
>
> The problem with code above is 4 branch instructions and the code I have just 4
> AND operations.

They'll be completely equivalent to the compiler, due to the
short-circuit evaluation of &&

Paul


\
 
 \ /
  Last update: 2008-04-03 20:59    [W:0.047 / U:0.484 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site