[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <AANLkTikZx3sCFvCUWUwtMfRzMsnQ9E2UWs4XbfCw5XID@mail.gmail.com>
Date: Thu, 10 Jun 2010 09:39:02 -0700
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Salman Qazi <sqazi@...gle.com>
Cc: Michel Lespinasse <walken@...gle.com>,
Peter Zijlstra <peterz@...radead.org>,
akpm@...ux-foundation.org, mingo@...e.hu,
linux-kernel@...r.kernel.org, tytso@...gle.com
Subject: Re: [PATCH] Fix a race in pid generation that causes pids to be
reused immediately.
On Wed, Jun 9, 2010 at 10:55 PM, Salman Qazi <sqazi@...gle.com> wrote:
> On Wed, Jun 9, 2010 at 10:17 PM, Michel Lespinasse <walken@...gle.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@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists