lkml.org 
[lkml]   [2020]   [Jan]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 4/6] locking/lockdep: Reuse freed chain_hlocks entries
On Mon, Dec 16, 2019 at 10:15:15AM -0500, Waiman Long wrote:
> +#define CHAIN_HLOCKS_MASK 0xffff

> +static inline void set_chain_block(int offset, int size, int next)
> +{
> + if (unlikely(offset < 0)) {
> + chain_block_buckets[0] = next;
> + return;
> + }
> + chain_hlocks[offset] = (next >> 16) | CHAIN_BLK_FLAG;
> + chain_hlocks[offset + 1] = next & CHAIN_HLOCKS_MASK;
> + if (size > MAX_CHAIN_BUCKETS) {
> + chain_hlocks[offset + 2] = size >> 16;
> + chain_hlocks[offset + 3] = size & CHAIN_HLOCKS_MASK;
> + }
> +}

AFAICT HLOCKS_MASK is superfluous. That is, you're assigning to a u16,
it will truncate automagically.

But if you want to make it more explicit, something like:

chain_hlocks[offset + 1] = (u16)next;

might be easier to read still.

\
 
 \ /
  Last update: 2020-01-13 16:52    [W:0.190 / U:9.984 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site