Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp3424819pxb; Mon, 4 Apr 2022 16:35:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz1BkVoa6n68I6UCq01AcHIGUXcFi6TpyAkairxtUGK6hGT3J1la/Yx7jJOg/4+hmEjdKhW X-Received: by 2002:a17:903:2343:b0:156:9ef3:6ff3 with SMTP id c3-20020a170903234300b001569ef36ff3mr512132plh.62.1649115305896; Mon, 04 Apr 2022 16:35:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649115305; cv=none; d=google.com; s=arc-20160816; b=ElMabV3fOJ+EaeIpW2O5DF/5JqVbI0pzMbAvnTrl8XIzw6RDtiA0OG3nWsKr9ZnYqN Ym9fpqG9qS7gCC1pS6LvVKVGeFEes266Mhygfd/bCqcdTBC3ckomOGAnp13cqHiWp/XA Fi8pu15gq+Tu7FbmJUbLu+xioKNmpC3ysJ2rpYdzU62SSsM32TTpeWpl+LDAy/+NSQPc KkuU0ljJTlMlLiGCOSkcII/QxIaxpz+b9WVXR0yqgh/iREbPckJhUbafnzdHkklG5gfh F/Dq3fPelGCRRQ7dONrAO/VV2kJBaVGK9jlTThxbtNNf/v2YWyRizsmCQLr5aqmu7PaG 2EHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=XpS5aZQkcSL10p2MN2J1N7nVQsjQzVnvWn1ELX+BXSY=; b=faWC7lcusBMgEdlN+ErzDsTSyKVTIeZ5IqjjP7Yt5mCYCgiR5GnYWk+nf0bE0JxOm9 Qxiu16isFuOMPnV1yMf9ey6Ds30UyT7PB3bwy7T+RREx4pWySdj4E/YVbwe+6xS+oA+z H8lMLZoNj3aqpmecTwq0y5TpAUJaVlBvtwDugTe1bzlBV9vWnk+F75dZG3E3Z0uPIRiU BDCA7XRRZK4fUovZyb5cLHeCzl1e+lM3iWcJujgLWV3bhGE48ENxLZauiHr4bJckVKaI xkxOkWzZz3L3GwUgaUfuw6p7jv7HQapdSxKlxZwIPzjhER2+I2wpGJxkQGuaIYSsrZJh K0AA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=bvAU1XgL; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id 1-20020a170902c24100b00156984a1cb4si5269559plg.306.2022.04.04.16.35.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Apr 2022 16:35:05 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=bvAU1XgL; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 10B78381A4; Mon, 4 Apr 2022 16:29:35 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347353AbiDDObU (ORCPT + 99 others); Mon, 4 Apr 2022 10:31:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55480 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377366AbiDDObS (ORCPT ); Mon, 4 Apr 2022 10:31:18 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D1D22222AA for ; Mon, 4 Apr 2022 07:29:18 -0700 (PDT) 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: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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).