Re: Mysterious driver-related oops in vm system

From: Linus Torvalds
Date: Sat Nov 15 2003 - 01:28:17 EST



On 15 Nov 2003, Steve Holland wrote:
>
nopage():
> v_addr = BoardData[board].dma_virt_addr + (address - vma->vm_start);
> page = virt_to_page(v_addr);
> get_page (page);
> return (page);

You can't do single-page memory management once you've already allocated
the board data as one big memory allocation.

In short: remove the "get_page()", since the thing that keeps the pages in
memory is actually the "pci_alloc_consistent()".

To make sure that the swapout logic doesn't try to touch these pages
as "normal" pages either, you should mark them all reserved.

Then, in the release() function you should unmark the pages, and finally
do the pci_free_consistent() on the area.

We really should have helper functions to do that. Right now every driver
that wants to do this needs to have its own logic for it (sound drivers
use "snd_malloc_pages()" that does it for them etc etc).

Linus

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