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

Re: mmap() for a cluster of pages



Hi,

On Mon, 26 Oct 1998 12:39:33 -0500 (EST), "Benjamin C.R. LaHaise" <blah@kvack.org> said:

> Stephen, in replying to this, I glanced at the sound driver's mmap
> routine.  They use an order > 0 buffer that they map, but don't do
> anything to prevent its being touched by the swap routines.  

I'm not sure quite which bit of the sound code you mean.  I can't see
anything wrong.  When we create a sound buffer (drivers/sound/dmabuf.c),
we explicitly set PG_reserved on every page in the buffer.  In
remap_page_range, there is the test

		mapnr = MAP_NR(__va(phys_addr));
		if (mapnr >= max_mapnr || PageReserved(mem_map+mapnr))
 			set_pte(pte, mk_pte_phys(phys_addr, prot));

which means that we won't do a remap on any page unless that page is
already protected against being seen by the swapper.  I think we're
quite safe here.

> My guess is simply that noone's encountered this bug before, but it's
> there.  

We should be OK.  Alan will no doubt scream if I'm wrong here.

> Also, is PG_reserved the best flag for this case?

Absolutely, it's the only flag we test for consistently when playing
silly buggers with page-present page table entries.

--Stephen
--
This is a majordomo managed list.  To unsubscribe, send a message with
the body 'unsubscribe linux-mm me@address' to: majordomo@kvack.org