Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp118485imm; Tue, 25 Sep 2018 17:23:24 -0700 (PDT) X-Google-Smtp-Source: ACcGV62NxjrMrOO0U71bh/xxAxhl/10Tn7FaEWzGwC+GbMFrpZIHRXp7sei7y0wGfgJsDwq9QoDU X-Received: by 2002:a63:1224:: with SMTP id h36-v6mr3267611pgl.120.1537921404940; Tue, 25 Sep 2018 17:23:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537921404; cv=none; d=google.com; s=arc-20160816; b=LGOueXVI9cvaKTS9bwIsJv76KVSEsJB+zK373Kjurtg2vFIRYA503aO3RTaXrbq3J8 btj2BimDhqAX/e9UHpGlzmkDaU032e7uMKJBM+pFzCqDLBAaNN1HxwZgFAg+9iOHYfyi Uk2z8Hab7AOMX9fIhCl6xbB4cL8UoD+tlrcDQJ13A6WECTHcZ1Mr0tQj75IwBWF5cuco CtH0f1FXh9M0kSV+3xESH213gSvJi3VCoboCJc8Xz6eVpb5DWZVv1wPEiW1MokfdlYEg E5oahu1PZpkdEP6ZpDs3XLrC6BcJ+VHI/qtWZE0fUlTA6gTqmCuAYvP7j5WoJBwapyYK EZTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=RUJ+LhE8LusZw0FOfM67hRNACwyCahRlb54GBaZ05a4=; b=RreCrY4UMeAmes/UaoS35mJQ9+w4CnlFQ5FjmAXGVbbDQeOizWgBa67qwytj+GRNIE UGsDKxpuwig9BKviQjLRw3illDMNs4LUVwsO1MCKqvMHd0/v4qWYoeC/FmAWLEgDarVt ShEBb37AX2VT+hNWGuInzWUmStCtoUbGdfdQW8VSGL2PWcA49QwHGIliL+X0YREAsZki yXlWy+XNp0e7h947QVKXOBiIEKnvkF9TwTC/YU0IprJgVxaD0uahBzmsfqDvkWnjtwz+ P2XO9XbzgYs/XA+kT7OAIeVzac4GttUcpBAcoXbhND/lIBKIWf+hSsu0vtTEcfCrg8TM Ggrg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 8-v6si3833438pgq.120.2018.09.25.17.23.09; Tue, 25 Sep 2018 17:23:24 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726368AbeIZGc2 (ORCPT + 99 others); Wed, 26 Sep 2018 02:32:28 -0400 Received: from ipmail06.adl6.internode.on.net ([150.101.137.145]:9491 "EHLO ipmail06.adl6.internode.on.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726124AbeIZGc2 (ORCPT ); Wed, 26 Sep 2018 02:32:28 -0400 Received: from ppp59-167-129-252.static.internode.on.net (HELO dastard) ([59.167.129.252]) by ipmail06.adl6.internode.on.net with ESMTP; 26 Sep 2018 09:52:20 +0930 Received: from dave by dastard with local (Exim 4.80) (envelope-from ) id 1g4xas-0006Sl-2p; Wed, 26 Sep 2018 10:22:18 +1000 Date: Wed, 26 Sep 2018 10:22:18 +1000 From: Dave Chinner To: Josef Bacik Cc: akpm@linux-foundation.org, linux-kernel@vger.kernel.org, kernel-team@fb.com, linux-btrfs@vger.kernel.org, riel@redhat.com, hannes@cmpxchg.org, tj@kernel.org, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org Subject: Re: [PATCH 1/8] mm: push vm_fault into the page fault handlers Message-ID: <20180926002217.GA18567@dastard> References: <20180925153011.15311-1-josef@toxicpanda.com> <20180925153011.15311-2-josef@toxicpanda.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180925153011.15311-2-josef@toxicpanda.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 25, 2018 at 11:30:04AM -0400, Josef Bacik wrote: > In preparation for caching pages during filemap faults we need to push > the struct vm_fault up a level into the arch page fault handlers, since > they are the ones responsible for retrying if we unlock the mmap_sem. > > Signed-off-by: Josef Bacik > --- > arch/alpha/mm/fault.c | 4 ++- > arch/arc/mm/fault.c | 2 ++ > arch/arm/mm/fault.c | 18 ++++++++----- > arch/arm64/mm/fault.c | 18 +++++++------ > arch/hexagon/mm/vm_fault.c | 4 ++- > arch/ia64/mm/fault.c | 4 ++- > arch/m68k/mm/fault.c | 5 ++-- > arch/microblaze/mm/fault.c | 4 ++- > arch/mips/mm/fault.c | 4 ++- > arch/nds32/mm/fault.c | 5 ++-- > arch/nios2/mm/fault.c | 4 ++- > arch/openrisc/mm/fault.c | 5 ++-- > arch/parisc/mm/fault.c | 5 ++-- > arch/powerpc/mm/copro_fault.c | 4 ++- > arch/powerpc/mm/fault.c | 4 ++- > arch/riscv/mm/fault.c | 2 ++ > arch/s390/mm/fault.c | 4 ++- > arch/sh/mm/fault.c | 4 ++- > arch/sparc/mm/fault_32.c | 6 ++++- > arch/sparc/mm/fault_64.c | 2 ++ > arch/um/kernel/trap.c | 4 ++- > arch/unicore32/mm/fault.c | 17 +++++++----- > arch/x86/mm/fault.c | 4 ++- > arch/xtensa/mm/fault.c | 4 ++- > drivers/iommu/amd_iommu_v2.c | 4 ++- > drivers/iommu/intel-svm.c | 6 +++-- > include/linux/mm.h | 16 +++++++++--- > mm/gup.c | 8 ++++-- > mm/hmm.c | 4 ++- > mm/ksm.c | 10 ++++--- > mm/memory.c | 61 +++++++++++++++++++++---------------------- > 31 files changed, 157 insertions(+), 89 deletions(-) > > diff --git a/arch/alpha/mm/fault.c b/arch/alpha/mm/fault.c > index d73dc473fbb9..3c98dfef03a9 100644 > --- a/arch/alpha/mm/fault.c > +++ b/arch/alpha/mm/fault.c > @@ -84,6 +84,7 @@ asmlinkage void > do_page_fault(unsigned long address, unsigned long mmcsr, > long cause, struct pt_regs *regs) > { > + struct vm_fault vmf = {}; > struct vm_area_struct * vma; > struct mm_struct *mm = current->mm; > const struct exception_table_entry *fixup; > @@ -148,7 +149,8 @@ do_page_fault(unsigned long address, unsigned long mmcsr, > /* If for any reason at all we couldn't handle the fault, > make sure we exit gracefully rather than endlessly redo > the fault. */ > - fault = handle_mm_fault(vma, address, flags); > + vm_fault_init(&vmfs, vma, flags, address); > + fault = handle_mm_fault(&vmf); Doesn't compile. > --- a/arch/arm/mm/fault.c > +++ b/arch/arm/mm/fault.c > @@ -225,17 +225,17 @@ static inline bool access_error(unsigned int fsr, struct vm_area_struct *vma) > } > > static vm_fault_t __kprobes > -__do_page_fault(struct mm_struct *mm, unsigned long addr, unsigned int fsr, > - unsigned int flags, struct task_struct *tsk) > +__do_page_fault(struct mm_struct *mm, struct vm_fault *vm, unsigned int fsr, vm_fault is *vm.... > + struct task_struct *tsk) > { > struct vm_area_struct *vma; > vm_fault_t fault; > > - vma = find_vma(mm, addr); > + vma = find_vma(mm, vmf->address); So this doesn't compile. > > check_stack: > - if (vma->vm_flags & VM_GROWSDOWN && !expand_stack(vma, addr)) > + if (vma->vm_flags & VM_GROWSDOWN && !expand_stack(vma, vmf->address)) > goto good_area; > out: > return fault; > @@ -424,6 +424,7 @@ static bool is_el0_instruction_abort(unsigned int esr) > static int __kprobes do_page_fault(unsigned long addr, unsigned int esr, > struct pt_regs *regs) > { > + struct vm_fault vmf = {}; > struct task_struct *tsk; > struct mm_struct *mm; > struct siginfo si; > @@ -493,7 +494,8 @@ static int __kprobes do_page_fault(unsigned long addr, unsigned int esr, > #endif > } > > - fault = __do_page_fault(mm, addr, mm_flags, vm_flags, tsk); > + vm_fault_init(&vmf, NULL, addr, mm_flags); > + fault = __do_page_fault(mm, vmf, vm_flags, tsk); I'm betting this doesn't compile, either. /me stops looking. Cheers, Dave. -- Dave Chinner david@fromorbit.com