Re: how to avoid allocating or freeze MOVABLE memory in userspace

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, 14 Apr 2012, Haojian Zhuang wrote:

> On Sat, Apr 14, 2012 at 2:27 AM, Christoph Lameter <cl@xxxxxxxxx> wrote:
> > On Fri, 13 Apr 2012, Haojian Zhuang wrote:
> >
> >> I have one question on memory migration. As we know, malloc() from
> >> user app will allocate MIGRATE_MOVABLE pages. But if we want to use
> >> this memory as DMA usage, we can't accept MIGRATE_MOVABLE type. Could
> >> we change its behavior before DMA working?
> >
> > MIGRATE_MOVABLE works fine for DMA. If you keep a reference from a device
> > driver to user pages then you will have to increase the page refcount
> > which will in turn pin the page and make it non movable for as long as you
> > keep the refcount.
>
> Hi Christoph,
>
> Thanks for your illustration. But it's a little abstract. Could you
> give me a simple example
> or show me the code?

Run get_user_pages() on the memory you are interest in pinning. See how
other drivers do that by looking up other use cases. F.e. ib_umem_get()
does a similar thing.



--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]