Messages in this thread | | | Date | Thu, 10 Jun 2010 09:39:02 -0700 | Subject | Re: [PATCH] Fix a race in pid generation that causes pids to be reused immediately. | From | Linus Torvalds <> |
| |
On Wed, Jun 9, 2010 at 10:55 PM, Salman Qazi <sqazi@google.com> wrote: > On Wed, Jun 9, 2010 at 10:17 PM, Michel Lespinasse <walken@google.com> wrote: >> >> As shown by the three compares version, the question here does not depend on >> the max_pid value. So, we can replace max_pid with any integer >= max_pid >> without changing the result.
I like the logical argument, and cannot fault it.
>> This is nice because, replacing max_pid with >> 2^32, the expression simplifies to: >> >> (unsigned)(a - base) < (unsigned)(b - base) >> >> I think I like this form after all :)
Sounds right to me.
> I don't mind doing this, if nobody disagrees. Should be fine with a > comment on top explaining the intention?
Yes. And lots of testing (including, very much, the whole max_pid roll-over, of course). The logic of it all seems impeccable, but nothing beats testing.
Thanks, Linus -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |