Skip to content
Snippets Groups Projects
  1. May 06, 2023
  2. Apr 06, 2023
  3. Feb 20, 2023
    • David Howells's avatar
      splice: Export filemap/direct_splice_read() · 7c8e01eb
      David Howells authored
      
      filemap_splice_read() and direct_splice_read() should be exported.
      
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      cc: Steve French <sfrench@samba.org>
      cc: Jens Axboe <axboe@kernel.dk>
      cc: Christoph Hellwig <hch@lst.de>
      cc: Al Viro <viro@zeniv.linux.org.uk>
      cc: David Hildenbrand <david@redhat.com>
      cc: John Hubbard <jhubbard@nvidia.com>
      cc: linux-cifs@vger.kernel.org
      cc: linux-mm@kvack.org
      cc: linux-block@vger.kernel.org
      cc: linux-fsdevel@vger.kernel.org
      Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
      7c8e01eb
    • David Howells's avatar
      splice: Add a func to do a splice from a buffered file without ITER_PIPE · 07073eb0
      David Howells authored
      
      Provide a function to do splice read from a buffered file, pulling the
      folios out of the pagecache directly by calling filemap_get_pages() to do
      any required reading and then pasting the returned folios into the pipe.
      
      A helper function is provided to do the actual folio pasting and will
      handle multipage folios by splicing as many of the relevant subpages as
      will fit into the pipe.
      
      The code is loosely based on filemap_read() and might belong in
      mm/filemap.c with that as it needs to use filemap_get_pages().
      
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      Reviewed-by: default avatarJens Axboe <axboe@kernel.dk>
      cc: Christoph Hellwig <hch@lst.de>
      cc: Al Viro <viro@zeniv.linux.org.uk>
      cc: David Hildenbrand <david@redhat.com>
      cc: John Hubbard <jhubbard@nvidia.com>
      cc: linux-mm@kvack.org
      cc: linux-block@vger.kernel.org
      cc: linux-fsdevel@vger.kernel.org
      Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
      07073eb0
    • David Howells's avatar
      mm: Pass info, not iter, into filemap_get_pages() · dd5b9d00
      David Howells authored
      
      filemap_get_pages() and a number of functions that it calls take an
      iterator to provide two things: the number of bytes to be got from the file
      specified and whether partially uptodate pages are allowed.  Change these
      functions so that this information is passed in directly.  This allows it
      to be called without having an iterator to hand.
      
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
      Reviewed-by: default avatarJens Axboe <axboe@kernel.dk>
      cc: Christoph Hellwig <hch@lst.de>
      cc: Matthew Wilcox <willy@infradead.org>
      cc: Al Viro <viro@zeniv.linux.org.uk>
      cc: David Hildenbrand <david@redhat.com>
      cc: John Hubbard <jhubbard@nvidia.com>
      cc: linux-mm@kvack.org
      cc: linux-block@vger.kernel.org
      cc: linux-fsdevel@vger.kernel.org
      Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
      dd5b9d00
  4. Feb 17, 2023
  5. Feb 10, 2023
  6. Feb 03, 2023
  7. Dec 12, 2022
    • Vishal Moola (Oracle)'s avatar
      filemap: convert replace_page_cache_page() to replace_page_cache_folio() · 3720dd6d
      Vishal Moola (Oracle) authored
      Patch series "Removing the lru_cache_add() wrapper".
      
      This patchset replaces all calls of lru_cache_add() with the folio
      equivalent: folio_add_lru().  This is allows us to get rid of the wrapper
      The series passes xfstests and the userfaultfd selftests.
      
      
      This patch (of 5):
      
      Eliminates 7 calls to compound_head().
      
      Link: https://lkml.kernel.org/r/20221101175326.13265-1-vishal.moola@gmail.com
      Link: https://lkml.kernel.org/r/20221101175326.13265-2-vishal.moola@gmail.com
      
      
      Signed-off-by: default avatarVishal Moola (Oracle) <vishal.moola@gmail.com>
      Reviewed-by: default avatarMatthew Wilcox (Oracle) <willy@infradead.org>
      Cc: Mike Kravetz <mike.kravetz@oracle.com>
      Cc: Miklos Szeredi <mszeredi@redhat.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      3720dd6d
    • Brian Foster's avatar
      filemap: skip write and wait if end offset precedes start · feeb9b26
      Brian Foster authored
      Patch series "filemap: skip write and wait if end offset precedes start",
      v2.
      
      A fix for the odd write and wait behavior described in the patch 1 commit
      log.  Technically patch 1 could simply remove the check rather than lift
      it into the callers, but this seemed a bit more user friendly to me. 
      Patch 2 is appended after observation that fadvise() interacted poorly
      with the v1 patch.  This is no longer a problem with v2, making patch 2
      purely a cleanup.
      
      This series survived both fstests and ltp regression runs without
      observable problems.  I had (end < start) warning checks in each relevant
      function, with fadvise() being the only caller that triggered them.  That
      said, I dropped the warnings after testing because there seemed to much
      potential for noise from the various other callers.
      
      
      This patch (of 2):
      
      A call to file[map]_write_and_wait_range() with an end offset that
      precedes the start offset but happens to land in the same page can trigger
      writeback submission but fails to wait on the submitted page.  Writeback
      submission occurs because __filemap_fdatawrite_range() passes both offsets
      down into write_cache_pages(), which rounds down to page indexes before it
      starts processing writeback.  However, __filemap_fdatawait_range()
      immediately returns if the byte-granular end offset precedes the start
      offset.
      
      This behavior was observed in the form of unpredictable latency from a
      frequent write and wait call with incorrect parameters.  The behavior gave
      the impression that the fdatawait path might occasionally fail to wait on
      writeback, but further investigation showed the latency was from
      write_cache_pages() waiting on writeback state to clear for a page already
      under writeback.  Therefore, this indicated that fdatawait actually never
      waits on writeback in this particular situation.
      
      The byte granular check in __filemap_fdatawait_range() goes all the way
      back to the old wait_on_page_writeback() helper.  It originally used page
      offsets and so would have waited in this problematic case.  That changed
      to byte granularity file offsets in commit 94004ed7 ("kill
      wait_on_page_writeback_range"), which subtly changed this behavior.  The
      check itself has become somewhat redundant since the error checking code
      that used to follow the wait loop (at the time of the aforementioned
      commit) has now been removed and lifted into the higher level callers.
      
      Therefore, we can restore historical fdatawait behavior by simply removing
      the check.  Since the current fdatawait behavior has been in place for
      quite some time and is consistent with other interfaces that use file
      offsets, instead lift the check into the file[map]_write_and_wait_range()
      helpers to provide consistent behavior between the write and wait.
      
      Link: https://lkml.kernel.org/r/20221128155632.3950447-1-bfoster@redhat.com
      Link: https://lkml.kernel.org/r/20221128155632.3950447-2-bfoster@redhat.com
      
      
      Signed-off-by: default avatarBrian Foster <bfoster@redhat.com>
      Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      feeb9b26
  8. Nov 09, 2022
  9. Oct 03, 2022
  10. Sep 27, 2022
  11. Sep 20, 2022
  12. Sep 12, 2022
  13. Jul 30, 2022
  14. Jul 25, 2022
    • Jens Axboe's avatar
      mm: honor FGP_NOWAIT for page cache page allocation · 0dd316ba
      Jens Axboe authored
      
      If we're creating a page cache page with FGP_CREAT but FGP_NOWAIT is
      set, we should dial back the gfp flags to avoid frivolous blocking
      which is trivial to hit in low memory conditions:
      
      [   10.117661]  __schedule+0x8c/0x550
      [   10.118305]  schedule+0x58/0xa0
      [   10.118897]  schedule_timeout+0x30/0xdc
      [   10.119610]  __wait_for_common+0x88/0x114
      [   10.120348]  wait_for_completion+0x1c/0x24
      [   10.121103]  __flush_work.isra.0+0x16c/0x19c
      [   10.121896]  flush_work+0xc/0x14
      [   10.122496]  __drain_all_pages+0x144/0x218
      [   10.123267]  drain_all_pages+0x10/0x18
      [   10.123941]  __alloc_pages+0x464/0x9e4
      [   10.124633]  __folio_alloc+0x18/0x3c
      [   10.125294]  __filemap_get_folio+0x17c/0x204
      [   10.126084]  iomap_write_begin+0xf8/0x428
      [   10.126829]  iomap_file_buffered_write+0x144/0x24c
      [   10.127710]  xfs_file_buffered_write+0xe8/0x248
      [   10.128553]  xfs_file_write_iter+0xa8/0x120
      [   10.129324]  io_write+0x16c/0x38c
      [   10.129940]  io_issue_sqe+0x70/0x1cc
      [   10.130617]  io_queue_sqe+0x18/0xfc
      [   10.131277]  io_submit_sqes+0x5d4/0x600
      [   10.131946]  __arm64_sys_io_uring_enter+0x224/0x600
      [   10.132752]  invoke_syscall.constprop.0+0x70/0xc0
      [   10.133616]  do_el0_svc+0xd0/0x118
      [   10.134238]  el0_svc+0x78/0xa0
      
      Clear IO, FS, and reclaim flags and mark the allocation as GFP_NOWAIT and
      add __GFP_NOWARN to avoid polluting dmesg with pointless allocations
      failures. A caller with FGP_NOWAIT must be expected to handle the
      resulting -EAGAIN return and retry from a suitable context without NOWAIT
      set.
      
      Reviewed-by: default avatarShakeel Butt <shakeelb@google.com>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      0dd316ba
  15. Jun 29, 2022
  16. Jun 20, 2022
  17. Jun 09, 2022
  18. May 13, 2022
    • Peter Xu's avatar
      mm: teach core mm about pte markers · 5c041f5d
      Peter Xu authored
      This patch still does not use pte marker in any way, however it teaches
      the core mm about the pte marker idea.
      
      For example, handle_pte_marker() is introduced that will parse and handle
      all the pte marker faults.
      
      Many of the places are more about commenting it up - so that we know
      there's the possibility of pte marker showing up, and why we don't need
      special code for the cases.
      
      [peterx@redhat.com: userfaultfd.c needs swapops.h]
        Link: https://lkml.kernel.org/r/YmRlVj3cdizYJsr0@xz-m1.local
      Link: https://lkml.kernel.org/r/20220405014833.14015-1-peterx@redhat.com
      
      
      Signed-off-by: default avatarPeter Xu <peterx@redhat.com>
      Cc: Alistair Popple <apopple@nvidia.com>
      Cc: Andrea Arcangeli <aarcange@redhat.com>
      Cc: Axel Rasmussen <axelrasmussen@google.com>
      Cc: David Hildenbrand <david@redhat.com>
      Cc: Hugh Dickins <hughd@google.com>
      Cc: Jerome Glisse <jglisse@redhat.com>
      Cc: "Kirill A . Shutemov" <kirill@shutemov.name>
      Cc: Matthew Wilcox <willy@infradead.org>
      Cc: Mike Kravetz <mike.kravetz@oracle.com>
      Cc: Mike Rapoport <rppt@linux.vnet.ibm.com>
      Cc: Nadav Amit <nadav.amit@gmail.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      5c041f5d
Loading