Approximate structure-allocation limit problem improvement

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

in chapter 5 (Counting), in the paragraph concerning "Approximate
structure-allocation limit problem", it is said:

"Similarly, sub_count() can fail even when the aggregate value of the
counter is nowhere near zero. In many cases, this is unacceptable."

In the case of the Quick Quiz 5.3 question, it's true that it's quite
a problem if it means freeing the structure fails because the counter
cannot be updated ! And freeing it without updating the counter means
the counter shifts from reality.

However, the very existence of the structure is a guarantee that the
real (total) counter value cannot be 0 or less than delta, so couldn't
we imagine to always succeed the sub_count operation by keeping a
global negative offset ? In the slow path, after globalize_count, if
the global count is lower than delta then we set it to 0 and we
increment the negative offset by what remains.

On the next slow path operation during a add_count, this negative
offset can be removed (or reduced) by reducing the local counter of
the thread by the same value.

This improvement over the proposed solution make it an acceptable
answer for the quick quiz 5.3 whereas it isn't without.

What do you think ?
Should I spend a bit of time writing a paragraph and a code sample about it ?

Regards,
Colin
--
To unsubscribe from this list: send the line "unsubscribe perfbook" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux