Re: Correct way to release get_user_pages()?

From: Andrew Morton
Date: Mon Jan 31 2005 - 16:13:08 EST


Timur Tabi <timur.tabi@xxxxxxxxxxx> wrote:
>
> Andrew Morton wrote:
>
> > no... You should only dirty the page if it was modified, and then use
> > set_page_dirty() or set_page_dirty_lock().
>
> If the page was modified, then shouldn't it already be marked dirty?

If the page is modified by a DMA transfer or by the CPU via the kernel's
page mappings then there is no record of its having been altered. Which is
why we must do it in software.

> Also, should I always use set_page_dirty_lock() if I haven't already
> locked the page?

If you don't have a reference on the page's inode, yes, you should use
set_page_dirty_lock(). If the page came from get_user_pages() then surely
you don't have a ref on the inode.
-
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/