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 05703C433EF for ; Fri, 18 Mar 2022 06:28:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id F29B88D0002; Fri, 18 Mar 2022 02:28:39 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id ED9BC8D0001; Fri, 18 Mar 2022 02:28:39 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DA1678D0002; Fri, 18 Mar 2022 02:28:39 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.27]) by kanga.kvack.org (Postfix) with ESMTP id C83BE8D0001 for ; Fri, 18 Mar 2022 02:28:39 -0400 (EDT) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 7FB9620F2 for ; Fri, 18 Mar 2022 06:28:39 +0000 (UTC) X-FDA: 79256528358.09.766A93D Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf13.hostedemail.com (Postfix) with ESMTP id 6B8922001C for ; Fri, 18 Mar 2022 06:28:38 +0000 (UTC) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.57]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4KKYvY1k6JzfYvf; Fri, 18 Mar 2022 14:27:05 +0800 (CST) Received: from [10.174.177.76] (10.174.177.76) 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.2308.21; Fri, 18 Mar 2022 14:28:34 +0800 Subject: Re: [PATCH v3 2/2] mm/memory-failure.c: make non-LRU movable pages unhandlable To: David Hildenbrand CC: , , Andrew Morton , , , References: <20220318073945.62164-1-linmiaohe@huawei.com> <20220318073945.62164-3-linmiaohe@huawei.com> <9f26eccb-d0f3-1c00-dce1-ab7fdd439fbb@redhat.com> From: Miaohe Lin Message-ID: <6f613668-6cc8-13eb-df81-1bfc3d9e6f22@huawei.com> Date: Fri, 18 Mar 2022 14:28:33 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: <9f26eccb-d0f3-1c00-dce1-ab7fdd439fbb@redhat.com> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.177.76] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 6B8922001C X-Stat-Signature: 4syt5c1bfqiwnrj78so5teomu9e7t8i5 Authentication-Results: imf13.hostedemail.com; dkim=none; spf=pass (imf13.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com X-HE-Tag: 1647584918-44008 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 2022/3/17 20:11, David Hildenbrand wrote: > On 18.03.22 08:39, Miaohe Lin wrote: >> We can not really handle non-LRU movable pages in memory failure. Typically >> they are balloon, zsmalloc, etc. Assuming we run into a base (4K) non-LRU >> movable page, we could reach as far as identify_page_state(), it should not >> fall into any category except me_unknown. For the non-LRU compound movable >> pages, they could be taken for transhuge pages but it's unexpected to split >> non-LRU movable pages using split_huge_page_to_list in memory_failure. So >> we could just simply make non-LRU movable pages unhandlable to avoid these >> possible nasty cases. >> >> Suggested-by: Yang Shi >> Signed-off-by: Miaohe Lin >> Reviewed-by: Yang Shi >> Acked-by: Naoya Horiguchi >> --- >> mm/memory-failure.c | 20 +++++++++++++------- >> 1 file changed, 13 insertions(+), 7 deletions(-) >> >> diff --git a/mm/memory-failure.c b/mm/memory-failure.c >> index ecf45961f3b6..bf14bea2ed93 100644 >> --- a/mm/memory-failure.c >> +++ b/mm/memory-failure.c >> @@ -1176,12 +1176,18 @@ void ClearPageHWPoisonTakenOff(struct page *page) >> * does not return true for hugetlb or device memory pages, so it's assumed >> * to be called only in the context where we never have such pages. >> */ >> -static inline bool HWPoisonHandlable(struct page *page) >> +static inline bool HWPoisonHandlable(struct page *page, unsigned long flags) >> { >> - return PageLRU(page) || __PageMovable(page) || is_free_buddy_page(page); >> + bool movable = false; >> + >> + /* Soft offline could mirgate non-LRU movable pages */ > > s/mirgate/migrate/ OK. My mistake. > >> + if ((flags & MF_SOFT_OFFLINE) && __PageMovable(page)) >> + movable = true; > > simply "return true" and drop "bool movable". OK. > >> + >> + return movable || PageLRU(page) || is_free_buddy_page(page); > Many thanks for comment!