Re: [PATCH] Add notification of page becoming writable to VMA ops
From: David Howells
Date: Tue Oct 25 2005 - 05:13:15 EST
Hugh Dickins <hugh@xxxxxxxxxxx> wrote:
> > + if (vma->vm_ops->page_mkwrite &&
> > + vma->vm_ops->page_mkwrite(vma, new_page) < 0)
> > + return VM_FAULT_SIGBUS;
> > + }
> > }
>
> This isn't necessarily wrong, and may be exactly how it was before,
> I don't remember. But it implies that when page_mkwrite fails,
> it page_cache_releases the page. Is that desirable? Or should
> that be left to the caller?
You're right. I've added a release. That may explain a memory leak I was
seeing that I couldn't find.
> > @@ -1945,7 +1998,7 @@ static int do_file_page(struct mm_struct
>
> Drop all those changes to do_file_page (which I added), they're no
> longer necessary. A case appeared which made it clear that we cannot
> rely on resolving this issue for get_user_pages in a single call to
> handle_mm_fault, and that's why the VM_FAULT_WRITE stuff got added.
I take it then that:
(1) the write_access parameter to do_file_page() is there purely so that
handle_pte_fault() can jump to it rather than calling it since they have
the same parameter set and return value;
(2) and that do_file_page() always installs a read-only PTE so that
do_wp_page() will be called subsequently on a write attempt.
David
-
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/