Re: [RESEND PATCH] cred: separate the refcount from frequently read fields

From: Linus Torvalds
Date: Thu Aug 22 2024 - 20:06:14 EST


On Thu, 22 Aug 2024 at 21:15, Mateusz Guzik <mjguzik@xxxxxxxxx> wrote:
>
> The refcount shares the cacheline with uid, gid and other frequently
> read fields.

So moving the refcount around looks sensible, but I don't see why you
moved 'non_rcu' away from the rcu head union.

Isn't 'non_rcu' accessed exactly when the refcount is accessed too? So
putting it in the same cacheline with ->usage would seem to make
sense, and you literally moved the RCU head there.

Why not move it as a union, and keep the non-rcu bit with the RCU head?

Yes, it is rarely actually written to and as such can be "mostly
read-only", but since it is both read and written next to refcounts,
why do that?

Did I miss some common use?

Linus