Re: [KVM PATCH v3 1/3] KVM: fix race in irq_routing logic

From: Gregory Haskins
Date: Tue Oct 27 2009 - 12:53:21 EST


Gleb Natapov wrote:
>>
>> 1) rcu_read_lock is something like 4x faster than srcu_read_lock(), but
>> we are talking about nanoseconds on modern hardware (I think Paul quoted
>> me 10ns vs 45ns on his rig). I don't think either overhead is something
>> to be concerned about in this case.
>>
> If we can avoid why not? Nanoseconds tend to add up.
>

BTW: I didn't mean to imply that we should be cavalier in adding
overhead. My point was that adding overhead is sometimes _necessary_ to
prevent a race above and beyond an RCU pointer acquisition, and 35ns is
not _terrible_ IMO.

I was suggesting to solve this by switching to SRCU, but an alternative
is copying the structure (when permitted with immutable objects), which
seems to work in this particular case. It should be noted that the copy
has its own unquantified overhead beyond basic RCU as well, so its not
truly free (I'd guess its <= as the switch to SRCU without copies, though).

IOW: sync hurts, but its sometimes a necessary evil ;)

Kind Regards,
-Greg

Attachment: signature.asc
Description: OpenPGP digital signature