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

Michał Nazarewicz
2010-11-16T17:36:07Z

On Tue, 16 Nov 2010 17:16:23 +0100, Johan MOSSBERG <johan.xx.mossberg@stericsson.com> wrote:

> Michał Nazarewicz wrote:
>> In particular, a cma_alloc() could return a pointer to an opaque
>> struct cma and to get physical address user would have to pin the
>> buffer with, say, cma_pin() and then call cma_phys() to obtain
>> physical address.

> I think cma_phys() is redundant, cma_pin() can return the physical
> address, that's how we did it in hwmem.

Makes sense. I'd add cma_phys() for convenience anyway.

>> I'm only wondering if treating "unpin" as "free" and pin as another
>> "alloc" would not suffice?

> I don't understand. Wouldn't you lose all the data in the buffer
> when you free it? How would we handle something like the desktop
> image which is blitted to the display all the time but never
> changes? We'd have to keep a scattered version and then copy it
> into a temporary contiguous buffer which is not optimal
> performance wise. The other alternative would be to keep the
> allocation but then we would get fragmentation problems.

Got it.

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?

--
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--