From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 37988C27C77 for ; Mon, 17 Jun 2024 05:32:10 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8DFB76B0137; Mon, 17 Jun 2024 01:32:09 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 88FF46B0138; Mon, 17 Jun 2024 01:32:09 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7572E6B0139; Mon, 17 Jun 2024 01:32:09 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 54DB46B0137 for ; Mon, 17 Jun 2024 01:32:09 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 03A26141309 for ; Mon, 17 Jun 2024 05:32:08 +0000 (UTC) X-FDA: 82239259578.20.C91F81A Received: from verein.lst.de (verein.lst.de [213.95.11.211]) by imf09.hostedemail.com (Postfix) with ESMTP id CD83514000B for ; Mon, 17 Jun 2024 05:32:06 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=none; spf=pass (imf09.hostedemail.com: domain of hch@lst.de designates 213.95.11.211 as permitted sender) smtp.mailfrom=hch@lst.de; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1718602321; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+5xOv7/magR3repHVTp/umPMo4N+WKa5FL2772MGV9Y=; b=fWI/5eHDHwB2QIu0UetwLEG5TMrZeyn4tyXr6E7YSwwfGXKXva+JT88Tw6xVOz5oWvJjUn vxiF0GYyHv+H9ZbfsYGey2RhuqU21GISnWm7JZD/of1LlCTli79TYbI0eLQhCKpUBpt5j7 LYObK3mQ9LgzQlwJs/t8vCmJDPOrb8U= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1718602321; a=rsa-sha256; cv=none; b=jNKT2IpfmFzdOIm2+Pd3mGqKnq9F2g6DxBEvwRGGll4q/Yk9helpbCrHzcpKzzHRAqm+tL oqnVnH+N3yyXiLA82h5sUm+dj1wYtczkQtFfY9NKbxHTALTPmiG1Txv3c8N9FCbh+MP87g 4O+bUDZilWRK5ZaNvis/CuC+GXp29mE= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=none; spf=pass (imf09.hostedemail.com: domain of hch@lst.de designates 213.95.11.211 as permitted sender) smtp.mailfrom=hch@lst.de; dmarc=none Received: by verein.lst.de (Postfix, from userid 2407) id DBE6F68B05; Mon, 17 Jun 2024 07:32:01 +0200 (CEST) Date: Mon, 17 Jun 2024 07:32:01 +0200 From: Christoph Hellwig To: Barry Song <21cnbao@gmail.com> Cc: Christoph Hellwig , Andrew Morton , Trond Myklebust , Anna Schumaker , Steve French , linux-nfs@vger.kernel.org, linux-cifs@vger.kernel.org, linux-mm@kvack.org, Barry Song , Ryan Roberts Subject: Re: [PATCH] nfs: fix nfs_swap_rw for large-folio swap Message-ID: <20240617053201.GA16852@lst.de> References: <20240614100329.1203579-1-hch@lst.de> <20240614100329.1203579-2-hch@lst.de> <20240614112148.cd1961e84b736060c54bdf26@linux-foundation.org> <20240616085436.GA28058@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.17 (2007-11-01) X-Stat-Signature: ozp6i4ocddtt3cehcukdf5pd9bgcgy1q X-Rspamd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5a/lZZDamXEyz7vQwQ9yZMxZqyVty1HiXnKzeHj3XVPHhOEg360ltfY0lg52mqjLCCIgVO6KAkR+rBlp83GlQzPPI2gjIYXBOEoJK/uLECPhW2JzRWoCZwBkSkH4m7w3hXw== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: 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 # 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] [ 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