linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Josef Bacik <josef@toxicpanda.com>
To: Dave Chinner <david@fromorbit.com>
Cc: akpm@linux-foundation.org, hannes@cmpxchg.org,
	kernel-team@fb.com, linux-btrfs@vger.kernel.org,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-mm@kvack.org, riel@redhat.com, tj@kernel.org
Subject: Re: [PATCH 1/8] mm: push vm_fault into the page fault handlers
Date: Tue, 25 Sep 2018 21:33:12 -0400	[thread overview]
Message-ID: <CAEzrpqeakEVhKz16=7m6RXCvdqHaTvZ-6j89vt1Zn9vLMwHhkg@mail.gmail.com> (raw)
In-Reply-To: <20180926002217.GA18567@dastard>

[-- Attachment #1: Type: text/plain, Size: 5070 bytes --]

(Only have my iPhone, sorry)

Hey it compiled on x86 and passed xfstests, good enough for an RFC.  I
thought kbuild testbot did these and since it hadn’t emailed me yet I
assumed I didn’t break anything (a bad assumption I know). I’ll go through
more thoroughly, but it for sure compiles on x86.  Thanks,

Josef

On Tue, Sep 25, 2018 at 8:22 PM Dave Chinner <david@fromorbit.com> wrote:

> 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 <josef@toxicpanda.com>
> > ---
> >  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
>

[-- Attachment #2: Type: text/html, Size: 6488 bytes --]

  reply	other threads:[~2018-09-26  1:33 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-25 15:30 [RFC][PATCH 0/8] drop the mmap_sem when doing IO in the fault path Josef Bacik
2018-09-25 15:30 ` [PATCH 1/8] mm: push vm_fault into the page fault handlers Josef Bacik
2018-09-26  0:22   ` Dave Chinner
2018-09-26  1:33     ` Josef Bacik [this message]
2018-09-25 15:30 ` [PATCH 2/8] mm: drop mmap_sem for page cache read IO submission Josef Bacik
2018-09-25 15:30 ` [PATCH 3/8] mm: clean up swapcache lookup and creation function names Josef Bacik
2018-09-25 15:30 ` [PATCH 4/8] mm: drop mmap_sem for swap read IO submission Josef Bacik
2018-09-25 15:30 ` [PATCH 5/8] mm: drop the mmap_sem in all read fault cases Josef Bacik
2018-09-25 15:30 ` [PATCH 6/8] mm: keep the page we read for the next loop Josef Bacik
2018-09-25 15:30 ` [PATCH 7/8] mm: add a flag to indicate we used a cached page Josef Bacik
2018-09-25 15:30 ` [PATCH 8/8] btrfs: drop mmap_sem in mkwrite for btrfs Josef Bacik
2018-09-26  0:24   ` Dave Chinner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAEzrpqeakEVhKz16=7m6RXCvdqHaTvZ-6j89vt1Zn9vLMwHhkg@mail.gmail.com' \
    --to=josef@toxicpanda.com \
    --cc=akpm@linux-foundation.org \
    --cc=david@fromorbit.com \
    --cc=hannes@cmpxchg.org \
    --cc=kernel-team@fb.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=riel@redhat.com \
    --cc=tj@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox