Re: [PATCH] IB/core: Make ib_mad_client_id atomic

From: Doug Ledford
Date: Thu Apr 19 2018 - 23:56:07 EST


On Wed, 2018-04-18 at 16:24 +0200, HÃkon Bugge wrote:
> Two kernel threads may get the same value for agent.hi_tid, if the
> agents are registered for different ports. As of now, this works, as
> the agent list is per port.
>
> It is however confusing and not future robust. Hence, making it
> atomic.
>

People sometimes underestimate the performance penalty of atomic ops.
Every atomic op is the equivalent of a spin_lock/spin_unlock pair. This
is why two atomics are worse than taking a spin_lock, doing what you
have to do, and releasing the spin_lock. Is this really what you want
for a "confusing, let's make it robust" issue?

--
Doug Ledford <dledford@xxxxxxxxxx>
GPG KeyID: B826A3330E572FDD
Key fingerprint = AE6B 1BDA 122B 23B4 265B 1274 B826 A333 0E57 2FDD

Attachment: signature.asc
Description: This is a digitally signed message part