Re: [PATCH 01/32] locking/lockdep: Use expanded masks on find_usage_*() functions

Linus Torvalds
2019-02-12T17:36:09Z

On Tue, Feb 12, 2019 at 9:14 AM Frederic Weisbecker <frederic@kernel.org> wrote:
>
> In order to perform softirq vector-finegrained locking validation we'll
> need to be able to check multiple vector usages at once. Prepare the low
> level usage mask check functions for that purpose.

Why is this using "u64 mask"?

That's not only fairly expensive on 32-bit targets, it wasn't what the
code did before:

> -static inline int usage_match(struct lock_list *entry, void *bit)
> +static inline int usage_match(struct lock_list *entry, void *mask)
> {
> - return entry->class->usage_mask & (1 << (enum lock_usage_bit)bit);
> + return entry->class->usage_mask & *(u64 *)mask;

Note how that was an "int" mask value before, and "usage_mask" itself
is just "unsigned long".

So where does that "u64" come from?

If there is some reason you really want to use a 64-bit value (some
future change?), it should be documented.

Linus