Re: [PATCH 09/20] mm: Factor out functionality to finish page faults

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

 



On Tue, Sep 27, 2016 at 06:08:13PM +0200, Jan Kara wrote:
> Introduce function finish_fault() as a helper function for finishing
> page faults. It is rather thin wrapper around alloc_set_pte() but since
> we'd want to call this from DAX code or filesystems, it is still useful
> to avoid some boilerplate code.
> 
> Signed-off-by: Jan Kara <jack@xxxxxxx>
> ---

> diff --git a/mm/memory.c b/mm/memory.c
> index 17db88a38e8a..f54cfad7fe04 100644
> --- a/mm/memory.c
> +++ b/mm/memory.c
> @@ -3029,6 +3029,36 @@ int alloc_set_pte(struct vm_fault *vmf, struct mem_cgroup *memcg,
>  	return 0;
>  }
>  
> +
> +/**
> + * finish_fault - finish page fault once we have prepared the page to fault
> + *
> + * @vmf: structure describing the fault
> + *
> + * This function handles all that is needed to finish a page fault once the
> + * page to fault in is prepared. It handles locking of PTEs, inserts PTE for
> + * given page, adds reverse page mapping, handles memcg charges and LRU
> + * addition. The function returns 0 on success, VM_FAULT_ code in case of
> + * error.
> + *
> + * The function expects the page to be locked.
> + */
> +int finish_fault(struct vm_fault *vmf)
> +{
> +	struct page *page;
> +	int ret;
> +
> +	/* Did we COW the page? */
> +	if (vmf->flags & FAULT_FLAG_WRITE && !(vmf->vma->vm_flags & VM_SHARED))

Oh, sorry, I did have one bit of feedback.  Maybe added parens around the flag
check for readability:

	if ((vmf->flags & FAULT_FLAG_WRITE) && !(vmf->vma->vm_flags & VM_SHARED))

Aside from that one nit:

Reviewed-by: Ross Zwisler <ross.zwisler@xxxxxxxxxxxxxxx>

--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux