Re: [PATCH 1/9] kernel: Provide READ_ONCE and ASSIGN_ONCE

From: George Spelvin
Date: Fri Dec 05 2014 - 16:38:12 EST


> Of prefer it to match the put_user model, which is (val, ptr). But as long
> as there is your safety (and the whole point of the macro is that it
> figures out the type from the pointer), I guess it doesn't matter too much
> in practice.
>
> I think my original suggestion also wrote it in lower case, since it
> actually works like a function (well, template, whatever). Again kind of
> like the user copy "functions".
>
> But I don't care *that* strongly.

That's an excellent point. But it means that Christian, you're free to
do whatever seems good to you.

I'm not rabid about it, either; I just figure that now is a good time
to think carefully about it.

Personally, after running through some different names that work
with (src,dst) order I'd try the pairs:

READ_ONCE(var) / WRITE_ONCE(value,var)
or
LOAD_ONCE(var) / STORE_ONCE(value,var)

Of the two, I think I prefer the latter, because that's what the
operations are called at the hardware level, so it's most evocative of
the actual semantics. "Assignment" is a higher-level concept.

But as I said, whatever you think best. I'd just like to advocate for
some actual thinking, because it's going to be all over the kernel and
a pain to change.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/