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

Linus Torvalds torvalds at linux-foundation.org
Fri Aug 23 00:05:43 UTC 2024


On Thu, 22 Aug 2024 at 21:15, Mateusz Guzik <mjguzik at gmail.com> 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



More information about the Linux-security-module-archive mailing list