Re: [PATCH 2/3] mm/mempolicy: refactor a read-once mechanism into a function for re-use

From: Gregory Price
Date: Wed Jan 17 2024 - 00:26:48 EST


On Mon, Jan 15, 2024 at 12:13:06PM +0800, Huang, Ying wrote:
> Gregory Price <gourry.memverge@xxxxxxxxx> writes:
>
> >
> > +static unsigned int read_once_policy_nodemask(struct mempolicy *pol,
> > + nodemask_t *mask)
>
> It may be more useful if we define this as memcpy_once(). That can be
> used not only for nodemask, but also other data structure.
>

Seemed better to do this is an entirely separate patch line to avoid
scope creep on reviews and such.

> > + barrier();
> > + __builtin_memcpy(mask, &pol->nodes, sizeof(nodemask_t));
>
> We don't use __builtin_memcpy() in kernel itself directly. Although it
> is used in kernel tools. So, I think it's better to use memcpy() here.
>

ack.

~Gregory