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 0A299C433EF for ; Mon, 4 Apr 2022 14:29:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 67D686B0072; Mon, 4 Apr 2022 10:29:30 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 62C966B0073; Mon, 4 Apr 2022 10:29:30 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4F4A86B0074; Mon, 4 Apr 2022 10:29:30 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0232.hostedemail.com [216.40.44.232]) by kanga.kvack.org (Postfix) with ESMTP id 3BED76B0072 for ; Mon, 4 Apr 2022 10:29:30 -0400 (EDT) Received: from smtpin25.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id EE80E824C424 for ; Mon, 4 Apr 2022 14:29:19 +0000 (UTC) X-FDA: 79319429238.25.E707CD2 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf17.hostedemail.com (Postfix) with ESMTP id 3680D4002F for ; Mon, 4 Apr 2022 14:29:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=XpS5aZQkcSL10p2MN2J1N7nVQsjQzVnvWn1ELX+BXSY=; b=bvAU1XgLDOVwe2ywssCcBJ6i7y girD+4D7WObAaZhLv/bNsnHQ96firOrDf3CVewm3tb5IbUSQTQaMxbBlHEwZVI19MYh5jsEZPqilU Q1i/bqz4cnyuQYuJ1Zh/wHNzVPqofZhj6dW5kUtLIFB7v1ICO9qBmGcR0dzzhGXeREm0oOa133xbe ZmXPv0sc1pB/cFhAim5noIwDvvfv6Fr3Gc/Ds6diOFYU/qoMDBPdor5PMTHPhZf/LPukm+Q5wRJeW J+Eqx9cF9+WHHGale+r+CJTrNzqRtUS2+bY3xla17aQiNptNaFiF2Mv/Uh49Mh6RXP7zzE1Bhp/VE rNuCDg1Q==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1nbNhh-005ng0-Os; Mon, 04 Apr 2022 14:29:13 +0000 Date: Mon, 4 Apr 2022 15:29:13 +0100 From: Matthew Wilcox To: Zi Yan Cc: Naoya Horiguchi , linux-kernel@vger.kernel.org, linux-mm@kvack.org, Andrew Morton , Michal Hocko , Naoya Horiguchi Subject: Re: v5.18-rc1: migratepages triggers VM_BUG_ON_FOLIO(folio_nr_pages(old) != nr_pages) Message-ID: References: <20220404132908.GA785673@u2004> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=bvAU1XgL; spf=none (imf17.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none X-Rspam-User: X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 3680D4002F X-Stat-Signature: y3wbeu5afmbfcccg6trwu9u4h5kk5xj5 X-HE-Tag: 1649082559-678817 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: On Mon, Apr 04, 2022 at 10:05:00AM -0400, Zi Yan wrote: > On 4 Apr 2022, at 9:29, Naoya Horiguchi wrote: > > I found that the below VM_BUG_ON_FOLIO is triggered on v5.18-rc1 > > (and also reproducible with mmotm on 3/31). > > I have no idea about the bug's mechanism, but it seems not to be > > shared in LKML yet, so let me just share. config.gz is attached. > > > > [ 48.206424] page:0000000021452e3a refcount:6 mapcount:0 mapping:000000003aaf5253 index:0x0 pfn:0x14e600 > > [ 48.213316] head:0000000021452e3a order:9 compound_mapcount:0 compound_pincount:0 > > [ 48.218830] aops:xfs_address_space_operations [xfs] ino:dee dentry name:"libc.so.6" > > [ 48.225098] flags: 0x57ffffc0012027(locked|referenced|uptodate|active|private|head|node=1|zone=2|lastcpupid=0x1fffff) > > [ 48.232792] raw: 0057ffffc0012027 0000000000000000 dead000000000122 ffff8a0dc9a376b8 > > [ 48.238464] raw: 0000000000000000 ffff8a0dc6b23d20 00000006ffffffff 0000000000000000 > > [ 48.244109] page dumped because: VM_BUG_ON_FOLIO(folio_nr_pages(old) != nr_pages) > > [ 48.249196] ------------[ cut here ]------------ > > [ 48.251240] kernel BUG at mm/memcontrol.c:6857! > > [ 48.260535] RIP: 0010:mem_cgroup_migrate+0x217/0x320 > > [ 48.286942] Call Trace: > > [ 48.287665] > > [ 48.288255] iomap_migrate_page+0x64/0x190 > > [ 48.289366] move_to_new_page+0xa3/0x470 > > Is it because migration code assumes all THPs have order=HPAGE_PMD_ORDER? > Would the patch below fix the issue? This looks entirely plausible to me! I do have changes in this area, but clearly I should have submitted them earlier. Let's get these fixes in as they are. Is there a test suite that tests page migration? I usually use xfstests and it does no page migration at all (at least 'git grep migrate' finds nothing useful).