[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87o95o15br.fsf@notabene.neil.brown.name>
Date: Wed, 03 Apr 2019 08:10:32 +1100
From: NeilBrown <neilb@...e.com>
To: David Laight <David.Laight@...LAB.COM>,
Thomas Graf <tgraf@...g.ch>,
Herbert Xu <herbert@...dor.apana.org.au>
Cc: "netdev\@vger.kernel.org" <netdev@...r.kernel.org>,
"linux-kernel\@vger.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH 3/4] rhashtable: use bit_spin_locks to protect hash bucket.
On Tue, Apr 02 2019, David Laight wrote:
> From: NeilBrown
>> Sent: 02 April 2019 00:08
>>
>> This patch changes rhashtables to use a bit_spin_lock on BIT(1) of the
>> bucket pointer to lock the hash chain for that bucket.
> ...
>> To enhance type checking, a new struct is introduced to represent the
>> pointer plus lock-bit
>> that is stored in the bucket-table. This is "struct rhash_lock_head"
>> and is empty. A pointer to this needs to be cast to either an
>> unsigned lock, or a "struct rhash_head *" to be useful.
>> Variables of this type are most often called "bkt".
>
> Did you try using a union of the pointer and an 'unsigned long' ?
> Should remove a lot of the casts.
It might, but I'm not sure it is what we want.
The value is not an unsigned long OR a pointer, it is both blended
together. So it really isn't a union.
We *want* it to require casts to access, so that it is clear that
something unusual is happening, and care is needed.
Thanks,
NeilBrown
Download attachment "signature.asc" of type "application/pgp-signature" (833 bytes)
Powered by blists - more mailing lists