This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch (preview)] libstdc++/24469


Paolo Carlini wrote:

I think everything is fine... Otherwise, please stop me before it's too late! :)

Well, I can see a serious problem myself but it's fixable ;)


In a pure producer/consumer scheme, for example, some threads only allocate and some, different, threads only deallocate, thus _M_used of the allocating threads can easily overflow, especially so the atomic counters, which are only 32-bits wide. The solution, simple, is resyncing _M_used of each thread to its reclaimed counterpart at the beginning of both _M_reclaim_block and _M_reserve_block (the fast allocations, using _M_adjust_freelist are not affected and the binary compatibility still safe). In order not to affect the performance we can do that every fixed number of allocations and deallocations, say 1 << 12 or something, and easily amortize the atomic... Will do tomorrow....

Paolo.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]