Re: [PATCH 0/3] hwmem: Hardware memory driver

Michał Nazarewicz
2010-11-19T10:44:21Z

On Wed, 17 Nov 2010 10:28:13 +0100, Johan MOSSBERG <johan.xx.mossberg@stericsson.com> wrote:

> Michał Nazarewicz wrote:
>> Do you want to remap user space mappings when page is moved during
>> defragmentation? Or would user need to unmap the region? Ie. would
>> mmap()ed buffer be pinned?
>
> Remap, i.e. not pinned. That means that the mapper needs to be
> informed before and after a buffer is moved. Maybe add a function
> to CMA where you can register a callback function that is called
> before and after a buffer is moved? The callback function's
> parameters would be buffer, new position and whether it will be
> moved or has been moved. CMA would also need this type of
> information to be able to evict temporary data from the
> destination.

The way I imagine pinning is that the allocator tells CMA that it want
to use given region of memory. This would make CMA remove any kind of
data that is stored there (in the version of CMA I'm about to post that
basically means migrating pages).

> I'm a little bit worried that this approach put constraints on the
> defragmentation algorithm but I can't think of any scenario where
> we would run into problems. If a defragmentation algorithm does
> temporary moves, and knows it at the time of the move, we would
> have to add a flag to the callback that indicates that the move is
> temporary so that it is not unnecessarily mapped, but that can be
> done when/if the problem occurs. Temporarily moving a buffer to
> scattered memory is not supported either but I suppose that can be
> solved by adding a flag that indicates that the new position is
> scattered, also something that can be done when needed.

I think the question at this moment is whether we need such a mechanism
to be implemented at the this time. I would rather wait with the
callback mechanism till the rest of the framework works and we have
an algorithm that actually does the defragmentation.

--
Best regards, _ _
| Humble Liege of Serenely Enlightened Majesty of o' \,=./ `o
| Computer Science, Michał "mina86" Nazarewicz (o o)
+----[mina86*mina86.com]---[mina86*jabber.org]----ooO--(_)--Ooo--