Re: [PATCH 10/17] prmem: documentation

From: Andy Lutomirski
Date: Wed Oct 31 2018 - 18:57:26 EST




> On Oct 31, 2018, at 2:00 PM, Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:
>
>> On Wed, Oct 31, 2018 at 01:36:48PM -0700, Andy Lutomirski wrote:
>>
>>>> On Oct 31, 2018, at 3:02 AM, Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:
>>>>
>>>> On Tue, Oct 30, 2018 at 09:41:13PM -0700, Andy Lutomirski wrote:
>>>> To clarify some of this thread, I think that the fact that rare_write
>>>> uses an mm_struct and alias mappings under the hood should be
>>>> completely invisible to users of the API. No one should ever be
>>>> handed a writable pointer to rare_write memory (except perhaps during
>>>> bootup or when initializing a large complex data structure that will
>>>> be rare_write but isn't yet, e.g. the policy db).
>>>
>>> Being able to use pointers would make it far easier to do atomics and
>>> other things though.
>>
>> This stuff is called *rare* write for a reason. Do we really want to
>> allow atomics beyond just store-release? Taking a big lock and then
>> writing in the right order should cover everything, no?
>
> Ah, so no. That naming is very misleading.
>
> We modify page-tables a _lot_. The point is that only a few sanctioned
> sites are allowed writing to it, not everybody.
>
> I _think_ the use-case for atomics is updating the reference counts of
> objects that are in this write-rare domain. But I'm not entirely clear
> on that myself either. I just really want to avoid duplicating that
> stuff.

Sounds nuts. Doing a rare-write is many hundreds of cycles at best. Using that for a reference count sounds wacky.

Can we see a *real* use case before we over complicate the API?