On Sat, Jun 15, 2024 at 6:25 AM Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> wrote: > > > The patch titled > Subject: nfs: fix nfs_swap_rw for large-folio swap > has been added to the -mm mm-unstable branch. Its filename is > nfs-fix-nfs_swap_rw-for-large-folio-swap.patch > > This patch will shortly appear at > https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/nfs-fix-nfs_swap_rw-for-large-folio-swap.patch > > This patch will later appear in the mm-unstable branch at > git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm > > Before you just go and hit "reply", please: > a) Consider who else should be cc'ed > b) Prefer to cc a suitable mailing list as well > c) Ideally: find the original patch on the mailing list and do a > reply-to-all to that, adding suitable additional cc's > > *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** > > The -mm tree is included into linux-next via the mm-everything > branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm > and is updated there every 2-3 working days > > ------------------------------------------------------ > From: Christoph Hellwig <hch@xxxxxx> > Subject: nfs: fix nfs_swap_rw for large-folio swap > Date: Fri, 14 Jun 2024 12:03:25 +0200 > > The series "large folios swap-in: handle refault cases first" will permit > the MM to swap out larger than page size chunks. NFS has all code ready > to handle this, but has a VM_BUG_ON that triggers when this happens. > Simply remove the VM_BUG_ON to fix this use case. > > Link: https://lkml.kernel.org/r/20240614100329.1203579-2-hch@xxxxxx > Signed-off-by: Christoph Hellwig <hch@xxxxxx> > Cc: Anna Schumaker <anna@xxxxxxxxxx> > Cc: Steve French <sfrench@xxxxxxxxx> > Cc: Trond Myklebust <trondmy@xxxxxxxxxx> > Cc: Chuanhua Han <hanchuanhua@xxxxxxxx> > Cc: Barry Song <v-songbaohua@xxxxxxxx> > Cc: Ryan Roberts <ryan.roberts@xxxxxxx> > Cc: Chris Li <chrisl@xxxxxxxxxx> > Cc: "Huang, Ying" <ying.huang@xxxxxxxxx> > Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> Hi Andrew, Christoph, As explained here[1], please hold this patch till the root cause is confirmed. I don't think "swap out larger than page size" is the cause. To me, the root cause is more of NeilBrown's "mm: submit multipage write for SWP_FS_OPS swap-space" which allows many pages plugged in an array and then unplugged all together. So, Cc: Neil Brown. I am going to send v3 with fixes tags once it gets double confirmed. commit 2282679fb20bf036a714ed49fadd0230c278a203 Author: NeilBrown <neilb@xxxxxxx> Date: Mon May 9 18:20:49 2022 -0700 mm: submit multipage write for SWP_FS_OPS swap-space swap_writepage() is given one page at a time, but may be called repeatedly in succession. For block-device swapspace, the blk_plug functionality allows the multiple pages to be combined together at lower layers. That cannot be used for SWP_FS_OPS as blk_plug may not exist - it is only active when CONFIG_BLOCK=y. Consequently all swap reads over NFS are single page reads. With this patch we pass a pointer-to-pointer via the wbc. swap_writepage can store state between calls - much like the pointer passed explicitly to swap_readpage. After calling swap_writepage() some number of times, the state will be passed to swap_write_unplug() which can submit the combined request. Link: https://lkml.kernel.org/r/164859778128.29473.5191868522654408537.stgit@noble.brown Signed-off-by: NeilBrown <neilb@xxxxxxx> Reviewed-by: Christoph Hellwig <hch@xxxxxx> Tested-by: David Howells <dhowells@xxxxxxxxxx> Tested-by: Geert Uytterhoeven <geert+renesas@xxxxxxxxx> Cc: Hugh Dickins <hughd@xxxxxxxxxx> Cc: Mel Gorman <mgorman@xxxxxxxxxxxxxxxxxxx> Cc: Trond Myklebust <trond.myklebust@xxxxxxxxxxxxxxx> Cc: Miaohe Lin <linmiaohe@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> [1] https://lore.kernel.org/linux-mm/CAGsJ_4xDkjN0X8ogE9djmu+nDUd_PJcSwr+GVH4vUiUAeJskaQ@xxxxxxxxxxxxxx/ > --- > > fs/nfs/direct.c | 2 -- > 1 file changed, 2 deletions(-) > > --- a/fs/nfs/direct.c~nfs-fix-nfs_swap_rw-for-large-folio-swap > +++ a/fs/nfs/direct.c > @@ -141,8 +141,6 @@ int nfs_swap_rw(struct kiocb *iocb, stru > { > ssize_t ret; > > - VM_BUG_ON(iov_iter_count(iter) != PAGE_SIZE); > - > if (iov_iter_rw(iter) == READ) > ret = nfs_file_direct_read(iocb, iter, true); > else > _ > > Patches currently in -mm which might be from hch@xxxxxx are > > nfs-fix-nfs_swap_rw-for-large-folio-swap.patch > > Thanks Barry