]> git.baikalelectronics.ru Git - kernel.git/commitdiff
userfaultfd: non-cooperative: optimize mremap_userfaultfd_complete()
authorAndrea Arcangeli <aarcange@redhat.com>
Wed, 22 Feb 2017 23:42:37 +0000 (15:42 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 23 Feb 2017 00:41:28 +0000 (16:41 -0800)
Optimize the mremap_userfaultfd_complete() interface to pass only the
vm_userfaultfd_ctx pointer through the stack as a microoptimization.

Link: http://lkml.kernel.org/r/20161216144821.5183-13-aarcange@redhat.com
Signed-off-by: Andrea Arcangeli <aarcange@redhat.com>
Reported-by: Hillf Danton <hillf.zj@alibaba-inc.com>
Acked-by: Mike Rapoport <rppt@linux.vnet.ibm.com>
Cc: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
Cc: Michael Rapoport <RAPOPORT@il.ibm.com>
Cc: Mike Kravetz <mike.kravetz@oracle.com>
Cc: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/userfaultfd.c
include/linux/userfaultfd_k.h
mm/mremap.c

index 68f978beefac16a337f11fb684c5c6b15ae17483..5d37c37854b094c08acdf5215b804570b15dad43 100644 (file)
@@ -608,11 +608,11 @@ void mremap_userfaultfd_prep(struct vm_area_struct *vma,
        }
 }
 
-void mremap_userfaultfd_complete(struct vm_userfaultfd_ctx vm_ctx,
+void mremap_userfaultfd_complete(struct vm_userfaultfd_ctx *vm_ctx,
                                 unsigned long from, unsigned long to,
                                 unsigned long len)
 {
-       struct userfaultfd_ctx *ctx = vm_ctx.ctx;
+       struct userfaultfd_ctx *ctx = vm_ctx->ctx;
        struct userfaultfd_wait_queue ewq;
 
        if (!ctx)
index 7f318a46044b0a88d88023efcee12841978524bd..78ec197e8b47ec4611be205259958cc46c4a6b04 100644 (file)
@@ -57,7 +57,7 @@ extern void dup_userfaultfd_complete(struct list_head *);
 
 extern void mremap_userfaultfd_prep(struct vm_area_struct *,
                                    struct vm_userfaultfd_ctx *);
-extern void mremap_userfaultfd_complete(struct vm_userfaultfd_ctx,
+extern void mremap_userfaultfd_complete(struct vm_userfaultfd_ctx *,
                                        unsigned long from, unsigned long to,
                                        unsigned long len);
 
@@ -100,7 +100,7 @@ static inline void mremap_userfaultfd_prep(struct vm_area_struct *vma,
 {
 }
 
-static inline void mremap_userfaultfd_complete(struct vm_userfaultfd_ctx ctx,
+static inline void mremap_userfaultfd_complete(struct vm_userfaultfd_ctx *ctx,
                                               unsigned long from,
                                               unsigned long to,
                                               unsigned long len)
index 504b560c013cb813ad1052757a9ff6183da7fc58..8779928d6a70258c55155861ab3dbd1f1020a4b6 100644 (file)
@@ -608,6 +608,6 @@ out:
        up_write(&current->mm->mmap_sem);
        if (locked && new_len > old_len)
                mm_populate(new_addr + old_len, new_len - old_len);
-       mremap_userfaultfd_complete(uf, addr, new_addr, old_len);
+       mremap_userfaultfd_complete(&uf, addr, new_addr, old_len);
        return ret;
 }