Re: cpu_number()
Re: cpu_number()
- Subject: Re: cpu_number()
- From: Prasad Lingutla <email@hidden>
- Date: Fri, 19 Aug 2011 09:55:06 -0700
>
> I know, I could take the hit and use a
> spinlock for those buffers, but depending on the configuration Lustre
> can log a lot of data and doing that could really hurt performance
Instead of taking a spinlock, can you consider using atomic increment(locked cmpxchg) to update the index into the buffer. This worked very well for me in the past for similar requirements. The thread writing at the end of the buffer and wraping around may have to do atomic increment twice depending on your implementation. You don't even need to disable preemption(assuming that size of data written by all threads simultaneously to this buffer is not greater than size of the buffer).
Thread may still need to loop around while atomically incrementing the index, but I don't think this will be such a performance hit compared to disabling preemption on a busy system.
-Prasad _______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden