Re: DMA page allocation

Andrea Arcangeli (andrea@suse.de)
Fri, 18 Jun 1999 00:50:05 +0200 (CEST)


On Thu, 17 Jun 1999, Jaroslav Kysela wrote:

>My solution wasn't intended to solve a problem with non-continuous memory
>regions for low memory machines. I need to solve the problem for machines

I had report from people gets failed allocation with 8mbyte machines. I
thought you was talking about the same problem.

I never experienced such failed allocation here though. Could you give
more info about which order of memory are you allocating? (64k?) Some time
ago I seen some message from Alan who said that also a 8k allocation is
going to fail easily btw.

>with 16MB+ memory. I have big trouble with my 128MB machine - there is not
>often free any DMA page.

Ok. Now the problem is clear to me :).

>Could you say me what's wrong with my solution (two independent page

It looks OK.

The only problem is that you "waste" (I know this is the feature but you
are not sure if somebody really needs such 2 mbyte of ram for doing DMA on
it) and you slowdown a bit GFP.

If you are OK to reserve 2mbyte of ram for DMA you may probably want to
more simply alloc the DMA memory at insmod time or better at kernel boot
time without using GFP, instead of allocing/free ram at every device
open/close. I know that at insmod time you may not find recyclable DMA
pages though... see below.

>I think that my solution give us better results than your with
>try_to_free_pages() fiddling, because there will be always possibility to
>have some pages locked for some reason when they are mixed one another,
>thus they can't be freed.

Sure, if for example the DMA pages are alloced for a kmalloced area then
we can't recycle them. But we may give DMA pages as first to vmalloced
areas and to the page cache. Then we may recycle them taking care of the
gfp_order that you requested.

We could use a GFP_KERNEL_REMAP to tell GFP to try to give us a DMA page
since we are going to alloc such memory in a place that will be easy to
remap fast. In the plain GFP_KERNEL case instead GFP will try to alloc a
no-DMA page.

Then we can remap and reserve some DMA memory for the order you requested
at GFP time if we can't find them at the first GFP try.

Again your way is fine but it would be nice to be able to get DMA pages
without having to reserve some fixed amount of ram. And think if somebody
needs more than 2mbyte of DMA ram (unlikely in the common case, but...).

Comments?

Andrea Arcangeli

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/