linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Barry Song <21cnbao@gmail.com>
To: Christoph Hellwig <hch@lst.de>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Trond Myklebust <trondmy@kernel.org>,
	 Anna Schumaker <anna@kernel.org>,
	Steve French <sfrench@samba.org>,
	linux-nfs@vger.kernel.org,  linux-cifs@vger.kernel.org,
	linux-mm@kvack.org,  Barry Song <v-songbaohua@oppo.com>,
	Ryan Roberts <ryan.roberts@arm.com>
Subject: Re: [PATCH] nfs: fix nfs_swap_rw for large-folio swap
Date: Mon, 17 Jun 2024 20:02:47 +1200	[thread overview]
Message-ID: <CAGsJ_4xQgY4kn46NO2=OWh2oDUj2F1-oYCRnKG4KCPJFfBT=Ng@mail.gmail.com> (raw)
In-Reply-To: <20240617053201.GA16852@lst.de>

On Mon, Jun 17, 2024 at 5:32 PM Christoph Hellwig <hch@lst.de> wrote:
>
> On Sun, Jun 16, 2024 at 06:23:16PM +0800, Barry Song wrote:
> > This is quite unusual. Could you share your setup and backtrace?
>
> Do this in an x86 kvm vm with 1G of memory:
>
> mkfs.xfs -f /dev/vdb
>
> mount /dev/vdb /mnt/nfs1
>
> # this requires the following line in /etc/exports to actually export the
> # file system: "/mnt/nfs2       localhost(rw,no_root_squash)"
> systemctl restart nfs-kernel-server
>
> mount -t nfs 127.0.0.1:/mnt/nfs1/ /mnt/test/
>
> cd /mnt/test
> dd if=/dev/zero of=swapfile bs=1024 count=524288
> mkswap swapfile
> chmod 0600 swapfile
> swapon swapfile

I did everything the same as above,
but always got failure at the last step to swapon:
/mnt/test # swapon swapfile
swapon: /mnt/test/swapfile: swapon failed: Invalid argument

the mount status:
/dev/vdb on /mnt/nfs1 type xfs
(rw,relatime,attr2,inode64,logbufs=8,logbsize=32k,noquota)
127.0.0.1:/mnt/nfs1 on /mnt/test type nfs4
(rw,relatime,vers=4.2,rsize=1048576,wsize=1048576,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,clientaddr=127.0.0.1,local_lock=none,addr=127.0.0.1)

As long as the swapfile is not on nfs, I am ok to swapon:
/mnt # swapon swapfile
[ 1150.302641] Adding 65532k swap on /mnt/swapfile.  Priority:-2
extents:1 across:65532k

Anything I am missing?

>
> # xfstests-dev is a checked out and built xfstests repo
> ~/xfstests-dev/src/usemem 1024
>
> The backtrace is at the end of the mail.
>
> > I'd
> > like to reproduce the issue, as the mm code only supports mTHP
> > swapout on block devices. What is your swap device or swap file?
>
> The above swap fіle on NFS is the only swap in the system
>
> > Additionally, on what kind of filesystem is the executable file built
> > from usemem.c located?
>
> Doesn't matter.  I've tried xfs, ext4 and nfs itself.
>
> root@testvm:~# ./xfstests-dev/src/usemem 1024
> [   65.065292] ------------[ cut here ]------------
> [   65.065528] kernel BUG at fs/nfs/direct.c:144!
> [   65.065724] Oops: invalid opcode: 0000 [#1] PREEMPT SMP NOPTI
> [   65.065988] CPU: 0 PID: 71 Comm: kswapd0 Not tainted 6.10.0-rc3+ #2587
> [   65.066270] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
> [   65.066683] RIP: 0010:nfs_swap_rw+0x3f/0x50
> [   65.066893] Code: 00 00 74 13 e8 e2 fb ff ff 31 d2 48 85 c0 48 0f 4f c2 c3 cc cc cc cc e8 9f f8 ff ff 31 0
> [   65.067698] RSP: 0018:ffffc900001b79c8 EFLAGS: 00010206
> [   65.067949] RAX: ffffffff8162afc0 RBX: ffff88800ca24c00 RCX: 0000000000000004
> [   65.068274] RDX: ffff88800ca24c30 RSI: ffffc900001b79d0 RDI: ffff88800ca24c00
> [   65.068588] RBP: ffff88800dd710e8 R08: 0000000000004000 R09: 0000000000000010
> [   65.068911] R10: 0000000000035a40 R11: 000000000000001d R12: ffffc900001b7a78
> [   65.069225] R13: ffffc900001b7db0 R14: ffffc900001b7a68 R15: ffffea00003f1c40
> [   65.069542] FS:  0000000000000000(0000) GS:ffff88803ec00000(0000) knlGS:0000000000000000
> [   65.069904] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> [   65.070157] CR2: 00005606ddec4dd0 CR3: 000000000365a003 CR4: 0000000000770ef0
> [   65.070472] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
> [   65.070784] DR3: 0000000000000000 DR6: 00000000ffff07f0 DR7: 0000000000000400
> [   65.071282] PKRU: 55555554
> [   65.071407] Call Trace:
> [   65.071519]  <TASK>
> [   65.071619]  ? die+0x31/0x80
> [   65.071754]  ? do_trap+0xd7/0x100
> [   65.071915]  ? do_error_trap+0x65/0x90
> [   65.072084]  ? nfs_swap_rw+0x3f/0x50
> [   65.072247]  ? exc_invalid_op+0x50/0x70
> [   65.072420]  ? nfs_swap_rw+0x3f/0x50
> [   65.072581]  ? asm_exc_invalid_op+0x1a/0x20
> [   65.072770]  ? __pfx_nfs_swap_rw+0x10/0x10
> [   65.072966]  ? nfs_swap_rw+0x3f/0x50
> [   65.073125]  swap_write_unplug+0x57/0x90
> [   65.073307]  shrink_folio_list+0x3a1/0xed0
> [   65.073500]  ? __mod_zone_page_state+0x61/0xa0
> [   65.073700]  ? isolate_lru_folios+0x2f3/0x400
> [   65.073902]  shrink_lruvec+0x587/0xb60
> [   65.074071]  ? shrink_slab+0x3ad/0x3c0
> [   65.074239]  ? shrink_slab+0x3ad/0x3c0
> [   65.074408]  shrink_node+0x2b7/0x7e0
> [   65.074569]  balance_pgdat+0x291/0x6f0


  reply	other threads:[~2024-06-17  8:03 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-14 10:03 fix swap on NFS Christoph Hellwig
2024-06-14 10:03 ` [PATCH] nfs: fix nfs_swap_rw for large-folio swap Christoph Hellwig
2024-06-14 17:52   ` Jeff Layton
2024-06-14 18:21   ` Andrew Morton
2024-06-16  0:16     ` Barry Song
2024-06-16  8:54       ` Christoph Hellwig
2024-06-16 10:23         ` Barry Song
2024-06-17  5:32           ` Christoph Hellwig
2024-06-17  8:02             ` Barry Song [this message]
2024-06-18  5:52               ` Christoph Hellwig
2024-06-18  6:05                 ` Barry Song
2024-06-18  6:13                   ` Christoph Hellwig
2024-06-18  6:31                     ` Barry Song
2024-06-17  8:03           ` Ryan Roberts
2024-06-17  9:40             ` Barry Song
2024-06-17 10:33               ` Ryan Roberts
2024-06-18  6:48   ` Martin Wege

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='CAGsJ_4xQgY4kn46NO2=OWh2oDUj2F1-oYCRnKG4KCPJFfBT=Ng@mail.gmail.com' \
    --to=21cnbao@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=anna@kernel.org \
    --cc=hch@lst.de \
    --cc=linux-cifs@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=ryan.roberts@arm.com \
    --cc=sfrench@samba.org \
    --cc=trondmy@kernel.org \
    --cc=v-songbaohua@oppo.com \
    /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