Yes, that that is the
if (write_to_vm)
flush_dcache_page(page);
> I find the write_to_vm condition confusion which is probably why
> I am sitting here spelling this out :-)
Hehe, actually these are confusing, but write_to_vm is probably the
least confusing wording I think. It means we are reading from the
device, thus writing to vm pages.
> At bio_unmap_user(), if we are going "device --> user" you have
> to flush_dcache_page(). And actually, this flush could just as
> legitimately occur at bio_map_user() time.
Thus
if (!write_to_vm)
flush_dcache_page(page);
> Therefore, the easiest thing to do is always flush_dcache_page()
> at bio_map_user().
>
> All the other cases are going to be like this, so we might as
> well cut to the chase and flush_dcache_page() for all the pages
> inside of get_user_pages().
>
> Whoever made get_user_pages() and didn't carry over the
> flush_dcache_page calls from the mechanism it is meant to replace
> should be spanked :-)
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 :)
-- 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/