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 EC3CBC433EF for ; Mon, 4 Apr 2022 15:18:31 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7F3756B0072; Mon, 4 Apr 2022 11:18:21 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7A3A76B0073; Mon, 4 Apr 2022 11:18:21 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 644146B0075; Mon, 4 Apr 2022 11:18:21 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0071.hostedemail.com [216.40.44.71]) by kanga.kvack.org (Postfix) with ESMTP id 5617F6B0072 for ; Mon, 4 Apr 2022 11:18:21 -0400 (EDT) Received: from smtpin19.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 19A09824C421 for ; Mon, 4 Apr 2022 15:18:11 +0000 (UTC) X-FDA: 79319552382.19.861761A Received: from out0.migadu.com (out0.migadu.com [94.23.1.103]) by imf22.hostedemail.com (Postfix) with ESMTP id 485A5C0036 for ; Mon, 4 Apr 2022 15:18:10 +0000 (UTC) Date: Tue, 5 Apr 2022 00:18:05 +0900 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1649085488; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=LZ2miKBTVPr3F+L5ojFoVTTDrRk5AYtrEEP/TQPrTdw=; b=iaj9dlWqaS7vybtNKFDB++49DZVieYTAJhxXSpIM6itTj+7vhMoGhgS47O1lXtt1WUFHvx OvjqHtyuLtXvPlGbr04YmWmDG31ijAiXNElchjylQ86whJp5pD/k1Riw9Nzpr3iz7OE3m0 L1nuSJjpjQ+uk7brFUkI/iuXgWggRm8= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Naoya Horiguchi To: Zi Yan Cc: Matthew Wilcox , 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: <20220404151805.GA800317@u2004> References: <20220404132908.GA785673@u2004> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: linux.dev Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=iaj9dlWq; spf=pass (imf22.hostedemail.com: domain of naoya.horiguchi@linux.dev designates 94.23.1.103 as permitted sender) smtp.mailfrom=naoya.horiguchi@linux.dev; dmarc=pass (policy=none) header.from=linux.dev X-Rspam-User: X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 485A5C0036 X-Stat-Signature: 87tw46hdh1urygipmp7diuohjtuax1xi X-HE-Tag: 1649085490-545735 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:47:20AM -0400, Zi Yan wrote: > On 4 Apr 2022, at 10:29, Matthew Wilcox wrote: > > > 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? I briefly confirmed that this bug didn't reproduce with your change, thank you very much! - Naoya Horiguchi > > > > 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). > > https://github.com/linux-test-project/ltp has some migrate_pages and move_pages > tests. You can run them after install ltp: > sudo ./runltp -f syscalls -s migrate_pages and > sudo ./runltp -f sys calls -s move_pages