Re: [PATCH] 2.5.21 Nonlinear CPU support

H. Peter Anvin (hpa@zytor.com)
Wed, 12 Jun 2002 15:21:43 -0700


Anton Altaparmakov wrote:
>>
>> Note that there is no requirement that we're still on cpu "cpu" when
>> we allocate the buffer. Furthermore, if we fail, we just loop right
>> back to the top.
>
>
> What is the point though? Why not just:
>
> if (!unlikely(decompression_buffers)) {
> down_sem();
> allocate_decompression_buffers();
> up_sem();
> }
>
> And be done with it?
>
> I don't see any justification for the increased complexity...
>

Race condition -- you have to drop out of the critical section before
you grab the allocation sempahore, and another CPU can grab the
semaphore in that time.

Thus, the buffers might appear right under your nose.

-hpa

-
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/