Re: [PATCH] 2.5.21 Nonlinear CPU support

From: H. Peter Anvin (hpa@zytor.com)
Date: Wed Jun 12 2002 - 17:21:43 EST


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/



This archive was generated by hypermail 2b29 : Sat Jun 15 2002 - 22:00:26 EST