Re: [PATCH RFC] Documentation: Add document for false sharing

From: Randy Dunlap
Date: Fri Mar 24 2023 - 00:30:27 EST


Hi--

On 3/23/23 20:03, Feng Tang wrote:
> Hi Randy,
>
> Thank you for the thorough reviews!
>
> On Thu, Mar 23, 2023 at 09:49:02AM -0700, Randy Dunlap wrote:
>> Hi,
>>
>> Lots of good/interesting info here.
>>
>> On 3/23/23 01:26, Feng Tang wrote:
>>> From: "Tang, Feng" <feng.tang@xxxxxxxxx>


>>> +
>>> +'refcount' is modified frequently, but 'name' is set once at object
>>> +creation time and is never modified. When many CPUs access 'foo' at
>>> +the same time, and 'refcount' is only bumped by one CPU frequently,
>>> +while 'name' is read by all other CPUs, which have to reload the whole
>>> +cache line over and over, even though the 'name' is never changed.
>>
>> That last "sentence" is not a sentence.
>
> How about:
>
> "
> When many CPUs access 'foo' at the same time, with 'refcount' being only
> bumped by one CPU frequently and 'name' being read by other CPUs, all
> those reading CPUs have to reload the whole cache line over and over
> due to the 'sharing', even though 'name' is never changed.
> "
> ?

Yes, that's good. Thanks.

--
~Randy