Re: [patch][cft] zero-copy dma cd writing and ripping

Jens Axboe (axboe@suse.de)
Mon, 28 Oct 2002 17:18:57 +0100


On Mon, Oct 28 2002, David S. Miller wrote:
> On Mon, 2002-10-28 at 07:54, Jens Axboe wrote:
> > I agree then. I will remove references to flush_dcache_page() in
> > bio_map_user() and bio_unmap_user(), and we'll just unconditionally do
> > flush_dcache_page() on every page mapped in get_user_pages(). That
> > sounds far better to me. Do you really expect users of get_user_pages()
> > to get this right (remember, we are often talking about device drivers
> > :-). I sure am not :)
>
> I have no expectations whatsoever :-)
> I totally agree with you.

Good, so it shall be then :-)

A related question. get_user_pages() does page_cache_get() on the page,
except if it's reserved. First question is 'why' doesn't it do that on a
reserved page? We get this conditional when mapping, and the unmapping
needs to check for reserved as well before doing page_cache_release().
Surely the extra reference would be ok to hold for PageReserved pages
as well?

And it not, there's a bug if get_user_pages() fails:

if (!PageReserved(pages[i]))
page_cache_get(pages[i]);

and if we ever fail:

while (i--)
page_cache_release(pages[i]);

-- 
Jens Axboe

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