Re: [PATCH] nfs: fix nfs_swap_rw for large-folio swap

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Jun 16, 2024 at 5:55 AM Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> wrote:
>
> On Fri, 14 Jun 2024 12:03:25 +0200 Christoph Hellwig <hch@xxxxxx> wrote:
>
> > As of Linux 6.10-rc the MM can 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.

As I understand it, this isn't happening because we don't support
mTHP swapping out to a swapfile, whether it's on NFS or any
other filesystem.
static int scan_swap_map_slots(struct swap_info_struct *si,
                               unsigned char usage, int nr,
                               swp_entry_t slots[], int order)
{
        ...
        if (order > 0) {
                ...

                /*
                 * Swapfile is not block device or not using clusters so unable
                 * to allocate large entries.
                 */
                if (!(si->flags & SWP_BLKDEV) || !si->cluster_info)
                        return 0;
        }
}

However, I'm pleased to see this patch, as we might need it someday.

> >
> > ...
> >
> > --- a/fs/nfs/direct.c
> > +++ b/fs/nfs/direct.c
> > @@ -141,8 +141,6 @@ int nfs_swap_rw(struct kiocb *iocb, struct iov_iter *iter)
> >  {
> >       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
>
> I'm thinking this should precede "mm: swap: entirely map large folios
> found in swapcache", or be a part of it.
>
> Barry/Chuanhua, any opinions?

The patch “mm: swap: entirely map large folios found in swapcache” does not
perform any I/O operations; it only maps the accessed large folio within the
swapcache. Therefore, this patch can be considered independent.

BTW, we haven't supported swapping out mTHP to nfs swapfile.

So, this patch is future-proof and can serve as a precedent if we
want to extend mthp swapout/swpin to non-blkdev systems.
Please correct me if I'm wrong, Ryan.

Thanks
Barry





[Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux