Received: by 2002:a05:7412:5112:b0:fa:6e18:a558 with SMTP id fm18csp323239rdb; Tue, 23 Jan 2024 00:06:50 -0800 (PST) X-Google-Smtp-Source: AGHT+IHRflzMEcCv+UdV8X+zvBtsa5NM+Z3KyXEZLiZWBHPSHabkn4YY/JFeen66l6iOGWpt6YrH X-Received: by 2002:a05:6402:4304:b0:55c:7cad:db35 with SMTP id m4-20020a056402430400b0055c7caddb35mr527858edc.43.1705997210364; Tue, 23 Jan 2024 00:06:50 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705997210; cv=pass; d=google.com; s=arc-20160816; b=h+MniHqbx5iAgoG3Nu+VJjfM4/Bg4v0pXQS4Dm6axTK2PfQfOuo7q12gpi1aCC+yKv ONB62JaPnhIo+3AcRTUvl1OeMaXpoWGEqgs18hEcywWlToUhPCbS334SIk9QqkPLRY3B rbTkG5OMtNIIxnYGdV+RKLN8Kn0jyyDPvL+SEYwN/94un2gjkEX7QcOG5575o+PqAEo+ myhux23I/XVmXT6Pd/BO16aHkH+QUQlS8OY9dpZ5uJPNpbeSiC/jkkvFs/WqKhDTi4sT BM6Nd1m/jpwCKlw0L8on4iWX5CMnMYBQXFgnu7N4K+mrWBPbEK4eH+SJ5UAGU3bGkXyI BBFg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:content-language:in-reply-to:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:user-agent:date :message-id:from:references:cc:to:subject; bh=NsB5RXX6szlLPBCs61PPgzrTQJ8lnI0HSi9QbYRuxFs=; fh=bA6cr69xDEd+YxCebSH8ew4+7GHZnzyOtC3/a3z3sAQ=; b=kmGAthmp2HOjL2g6MojLBM3y4i15o/1uSuvz+SBTx0Tf4T/y/kfYjTxv1Uq0Xt4sFM uFVn4fYkVH+uN0rIsTzRND8kXfB3GPpN47ziOFrHo1YwuvMI2Js2K0Jdtzs91UM3eEwW LA7ZS3Vfa0OeaA9BFA1Bb0vAQ0qnxs1wwY9r1o2QWw8ZQIp3quLLKBNNhOMAwiV/KV5B 8beQRVGU0PJo+wJwCam+odR9E21QVXmLY2GlWZZZv0J+K64rr0nWusBfwf/z8HgQq1Cn zxvPsd4fOYerBerlC6JWWbgF+q6RVCxw5NOTDD6CgKW2EMc3pKCyhs0GdeF3rFeyPXDf JAbA== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-34864-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-34864-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id en13-20020a056402528d00b00558740d4f83si12079775edb.101.2024.01.23.00.06.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jan 2024 00:06:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-34864-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-34864-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-34864-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 108641F2384D for ; Tue, 23 Jan 2024 08:06:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4C8F256B62; Tue, 23 Jan 2024 08:06:28 +0000 (UTC) Received: from szxga04-in.huawei.com (szxga04-in.huawei.com [45.249.212.190]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3A7F45675D for ; Tue, 23 Jan 2024 08:06:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.190 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705997187; cv=none; b=MuBMymaxRoR4eb+/MoL2lYol0IMwQiPB67To2BpPWwNhlDeYBJhvHYvi3/Wl2KwEhd0OKC8XX86uzf3wi6q2BScpVaw8yTop0OY0yHOjbxXRn69OZ+zSM6Efrxn5aR7VlBO8GU0B5lehIXdUX9/Ata0Appop2qKmGE7hCK03KuY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705997187; c=relaxed/simple; bh=LZ+NZo7qdlXNCUJZcu2qtSXl9a+sOqKHa4APCYHWXZ4=; h=Subject:To:CC:References:From:Message-ID:Date:MIME-Version: In-Reply-To:Content-Type; b=EePeEo8EUuk8yo56LLNnW6Mx1k7/TtdHsd4KY9jbPPLZE27/n2pQQS+86JHYELRX3zsxw8PewPaYl958TZw6WmXfvhYhtGqfYWXp/8WQFZAtfvluSHw/KcT0noAM4e8luLG9O7FnP4wMTQ0Mzmk6TUH1eHxFJKjmj5BvxFy4ZjY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.190 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.163.17]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4TK0511RKzz1xmcD; Tue, 23 Jan 2024 16:05:25 +0800 (CST) Received: from canpemm500002.china.huawei.com (unknown [7.192.104.244]) by mail.maildlp.com (Postfix) with ESMTPS id 34F981A0172; Tue, 23 Jan 2024 16:06:16 +0800 (CST) Received: from [10.173.135.154] (10.173.135.154) by canpemm500002.china.huawei.com (7.192.104.244) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Tue, 23 Jan 2024 16:06:09 +0800 Subject: Re: [PATCH] mm/memory-failure: fix crash in split_huge_page_to_list from soft_offline_page To: Matthew Wilcox CC: , , , References: <20240120065729.3276395-1-linmiaohe@huawei.com> From: Miaohe Lin Message-ID: Date: Tue, 23 Jan 2024 16:06:09 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To canpemm500002.china.huawei.com (7.192.104.244) On 2024/1/22 22:36, Matthew Wilcox wrote: > On Mon, Jan 22, 2024 at 08:57:06PM +0800, Miaohe Lin wrote: >> On 2024/1/21 10:00, Matthew Wilcox wrote: >>> On Sat, Jan 20, 2024 at 02:57:29PM +0800, Miaohe Lin wrote: >>>> { >>>> - /* Soft offline could migrate non-LRU movable pages */ >>>> - if ((flags & MF_SOFT_OFFLINE) && __PageMovable(page)) >>>> + /* >>>> + * Soft offline could migrate non-LRU movable pages. >>>> + * Note that page->mapping is overloaded with slab->slab_list or slabs >>>> + * fields which might make slab pages appear like non-LRU movable pages. >>>> + * So __PageMovable() has to be done after PageSlab() is checked. >>>> + */ >>>> + if ((flags & MF_SOFT_OFFLINE) && !PageSlab(page) && __PageMovable(page)) >>>> return true; >>>> >>>> return PageLRU(page) || is_free_buddy_page(page); >>> >>> I think would make more sense as >>> >>> + if (PageSlab(page)) >>> + return false; >> >> Do you mean add PageSlab check above "if ((flags & MF_SOFT_OFFLINE) && __PageMovable(page))" block >> so we don't need to add more comment? > > Yes, although not just that we don't need to add a comment. > Fundamentally, if you see PageSlab, you don't need to test anything > else, you know it's not migratable. Yes, this really makes sense. > >> I have a concern that __PageMovable() seems unreliable now if we access page from random context. >> This might introduce some potential problems. For example, offline_pages() might be stumped with >> such pages without any progress until signal occurs IIUC: >> >> offline_pages >> .. >> do { >> scan_movable_pages >> if (__PageMovable(page)) -- It might be slab page here. ret will also be set to 0. >> goto found; >> do_migrate_range -- Failed to isolate slab page and retry. >> } while (!ret) -- retry since ret is 0. >> >> There might be many similar scenes, but I haven't taken them more closely. Maybe these are >> just dumb problems... > > Yep, lots of places are insufficiently careful about testing > PageMovable. This will get fixed with memdescs, but we're a fair way > from having memdescs ... I believe memdescs will fix all these mess, but we might need to fix them before memdescs becoming ready as a compromise. Thanks. > > . >