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 X-Spam-Level: X-Spam-Status: No, score=-0.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3052BC4360C for ; Sat, 12 Oct 2019 10:30:54 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id E7094206A1 for ; Sat, 12 Oct 2019 10:30:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E7094206A1 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 806CD6B0003; Sat, 12 Oct 2019 06:30:53 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7906B6B0005; Sat, 12 Oct 2019 06:30:53 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 631B18E0005; Sat, 12 Oct 2019 06:30:53 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0137.hostedemail.com [216.40.44.137]) by kanga.kvack.org (Postfix) with ESMTP id 3AA9C6B0003 for ; Sat, 12 Oct 2019 06:30:53 -0400 (EDT) Received: from smtpin10.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with SMTP id CFB193A91 for ; Sat, 12 Oct 2019 10:30:52 +0000 (UTC) X-FDA: 76034764344.10.78559DB Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin10.hostedemail.com (Postfix) with ESMTP id AFA3B16A4B8; Sat, 12 Oct 2019 10:30:52 +0000 (UTC) X-HE-Tag: uncle84_24ae4f3abc50f X-Filterd-Recvd-Size: 5307 Received: from mx1.suse.de (mx2.suse.de [195.135.220.15]) by imf01.hostedemail.com (Postfix) with ESMTP; Sat, 12 Oct 2019 10:30:51 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id E3AE6B5BE; Sat, 12 Oct 2019 10:30:49 +0000 (UTC) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Date: Sat, 12 Oct 2019 12:30:48 +0200 From: osalvador To: Qian Cai Cc: Naoya Horiguchi , linux-kernel@vger.kernel.org, linux-mm@kvack.org, David Hildenbrand , Michal Hocko , Mike Kravetz , owner-linux-mm@kvack.org Subject: Re: memory offline infinite loop after soft offline In-Reply-To: <1570829564.5937.36.camel@lca.pw> References: <1570829564.5937.36.camel@lca.pw> Message-ID: <55ff76d109062a87fb209ecddf167b71@suse.de> X-Sender: osalvador@suse.de User-Agent: Roundcube Webmail Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000001, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 2019-10-11 23:32, Qian Cai wrote: > # /opt/ltp/runtest/bin/move_pages12 > move_pages12.c:263: INFO: Free RAM 258988928 kB > move_pages12.c:281: INFO: Increasing 2048kB hugepages pool on node 0 to= =20 > 4 > move_pages12.c:291: INFO: Increasing 2048kB hugepages pool on node 8 to= =20 > 4 > move_pages12.c:207: INFO: Allocating and freeing 4 hugepages on node 0 > move_pages12.c:207: INFO: Allocating and freeing 4 hugepages on node 8 > move_pages12.c:197: PASS: Bug not reproduced > move_pages12.c:197: PASS: Bug not reproduced >=20 > for mem in $(ls -d /sys/devices/system/memory/memory*); do > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0echo offline > $mem/sta= te > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0echo online > $mem/stat= e > done >=20 > That LTP move_pages12 test will first madvise(MADV_SOFT_OFFLINE) for a=20 > range. > Then, one of "echo offline" will trigger an infinite loop in=20 > __offline_pages() > here, I did not deeply check whether this issue is really related=20 soft-offline. As is, soft-offline has a few issues that can lead to tricky problems. Actually, lately I have received quite a few reports from customers=20 where testing soft-offline resulted in applications crashing all around. I am working on a re-implementation to fix those issues [1]. I yet have to fix a bug I found yesterday though, but it should be quite=20 trivial to fix it up, so I should be able to send a new re-spin next=20 week. [1] https://lore.kernel.org/patchwork/cover/1126173/ Thanks >=20 > /* check again */ > ret =3D walk_system_ram_range(start_pfn, end_pfn - start_pfn, > =C2=A0=C2=A0=C2=A0=C2=A0NULL, check_pages_isolated_cb); > } while (ret); >=20 > because check_pages_isolated_cb() always return -EBUSY from > test_pages_isolated(), >=20 >=20 > pfn =3D __test_page_isolated_in_pageblock(start_pfn, end_pfn, > skip_hwpoisoned_pages); > ... > return pfn < end_pfn ? -EBUSY : 0; >=20 > The root cause is in __test_page_isolated_in_pageblock() where "pfn" is= =20 > always > less than "end_pfn" because the associated page is not a PageBuddy. >=20 > while (pfn < end_pfn) { > ... > else > break; >=20 > return pfn; >=20 > Adding a dump_page() for that pfn shows, >=20 > [=C2=A0=C2=A0101.665160][ T8885] pfn =3D 77501, end_pfn =3D 78000 > [=C2=A0=C2=A0101.665245][ T8885] page:c00c000001dd4040 refcount:0 mapco= unt:0 > mapping:0000000000000000 index:0x0 > [=C2=A0=C2=A0101.665329][ T8885] flags: 0x3fffc000000000() > [=C2=A0=C2=A0101.665391][ T8885] raw: 003fffc000000000 0000000000000000= =20 > ffffffff01dd0500 > 0000000000000000 > [=C2=A0=C2=A0101.665498][ T8885] raw: 0000000000000000 0000000000000000= =20 > 00000000ffffffff > 0000000000000000 > [=C2=A0=C2=A0101.665588][ T8885] page dumped because: soft_offline > [=C2=A0=C2=A0101.665639][ T8885] page_owner tracks the page as freed > [=C2=A0=C2=A0101.665697][ T8885] page last allocated via order 5, migra= tetype=20 > Movable, > gfp_mask > 0x346cca(GFP_HIGHUSER_MOVABLE|__GFP_NOWARN|__GFP_RETRY_MAYFAIL|__GFP_CO= MP|__GFP_ > THISNODE) > [=C2=A0=C2=A0101.665924][ T8885]=C2=A0=C2=A0prep_new_page+0x3c0/0x440 > [=C2=A0=C2=A0101.665962][ T8885]=C2=A0=C2=A0get_page_from_freelist+0x25= 68/0x2bb0 > [=C2=A0=C2=A0101.666059][ T8885]=C2=A0=C2=A0__alloc_pages_nodemask+0x1b= 4/0x670 > [=C2=A0=C2=A0101.666115][ T8885]=C2=A0=C2=A0alloc_fresh_huge_page+0x244= /0x6e0 > [=C2=A0=C2=A0101.666183][ T8885]=C2=A0=C2=A0alloc_migrate_huge_page+0x3= 0/0x70 > [=C2=A0=C2=A0101.666254][ T8885]=C2=A0=C2=A0alloc_new_node_page+0xc4/0x= 380 > [=C2=A0=C2=A0101.666325][ T8885]=C2=A0=C2=A0migrate_pages+0x3b4/0x19e0 > [=C2=A0=C2=A0101.666375][ T8885]=C2=A0=C2=A0do_move_pages_to_node.isra.= 29.part.30+0x44/0xa0 > [=C2=A0=C2=A0101.666464][ T8885]=C2=A0=C2=A0kernel_move_pages+0x498/0xf= c0 > [=C2=A0=C2=A0101.666520][ T8885]=C2=A0=C2=A0sys_move_pages+0x28/0x40 > [=C2=A0=C2=A0101.666643][ T8885]=C2=A0=C2=A0system_call+0x5c/0x68 > [=C2=A0=C2=A0101.666665][ T8885] page last free stack trace: > [=C2=A0=C2=A0101.666704][ T8885]=C2=A0=C2=A0__free_pages_ok+0xa4c/0xd40 > [=C2=A0=C2=A0101.666773][ T8885]=C2=A0=C2=A0update_and_free_page+0x2dc/= 0x5b0 > [=C2=A0=C2=A0101.666821][ T8885]=C2=A0=C2=A0free_huge_page+0x2dc/0x740 > [=C2=A0=C2=A0101.666875][ T8885]=C2=A0=C2=A0__put_compound_page+0x64/0x= c0 > [=C2=A0=C2=A0101.666926][ T8885]=C2=A0=C2=A0putback_active_hugepage+0x2= 28/0x390 > [=C2=A0=C2=A0101.666990][ T8885]=C2=A0=C2=A0migrate_pages+0xa78/0x19e0 > [=C2=A0=C2=A0101.667048][ T8885]=C2=A0=C2=A0soft_offline_page+0x314/0x1= 050 > [=C2=A0=C2=A0101.667117][ T8885]=C2=A0=C2=A0sys_madvise+0x1068/0x1080 > [=C2=A0=C2=A0101.667185][ T8885]=C2=A0=C2=A0system_call+0x5c/0x68