From patchwork Tue Aug 30 12:36:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miaohe Lin X-Patchwork-Id: 12959266 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 6FAD6ECAAA1 for ; Tue, 30 Aug 2022 12:36:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9242C6B0074; Tue, 30 Aug 2022 08:36:39 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 855C5940008; Tue, 30 Aug 2022 08:36:39 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 487CF940007; Tue, 30 Aug 2022 08:36:39 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 27BA06B0074 for ; Tue, 30 Aug 2022 08:36:39 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 01455160CFB for ; Tue, 30 Aug 2022 12:36:38 +0000 (UTC) X-FDA: 79856207718.27.6673636 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by imf05.hostedemail.com (Postfix) with ESMTP id 35D3B10000B for ; Tue, 30 Aug 2022 12:36:38 +0000 (UTC) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.56]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4MH6Fh3fQkzHnVM; Tue, 30 Aug 2022 20:34:48 +0800 (CST) Received: from huawei.com (10.175.124.27) 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.2375.24; Tue, 30 Aug 2022 20:36:34 +0800 From: Miaohe Lin To: , CC: , , Subject: [PATCH 2/6] mm, hwpoison: use __PageMovable() to detect non-lru movable pages Date: Tue, 30 Aug 2022 20:36:00 +0800 Message-ID: <20220830123604.25763-3-linmiaohe@huawei.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20220830123604.25763-1-linmiaohe@huawei.com> References: <20220830123604.25763-1-linmiaohe@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.124.27] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1661862998; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Y1McSJydXoxcwnnSt53LN6QCFXnwsUyAG9rVoZ/5U6E=; b=637Qge95pawbrSzf7aSAPwgfMhrWExsgr89BsLL7xgJNwHvYeS237iqDBwX3o4DMSgCv5L cbXgZl0oyYqOcfKW90/FIKqR3uL2AShCKOhXkmM8faoCSZ5z2RjAwqrledzo4usakbVk/n iNClMc7QJW0V0/Wu7UXRExqjYNxlJnc= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=none; spf=pass (imf05.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.189 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1661862998; a=rsa-sha256; cv=none; b=BjAi8DjPoMp38Gb4916+Sn/g+lmuwW2y4i9xn+Txtxyq6L+zttMcJTN8oQjdf6pq6M8Apq Jrsg0Mdp9fIbIfiYrRxMhtrkAlANkj2KfUM9yj0UG6g7DyCRL7cYC50sxHvNtOssvqNNNC njUYEOB5PqJBVYcXC22QYezlbNVq8dc= X-Stat-Signature: 7duenpntztzheibshp57fqy47xfrg94i X-Rspam-User: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 35D3B10000B Authentication-Results: imf05.hostedemail.com; dkim=none; spf=pass (imf05.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.189 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com X-HE-Tag: 1661862998-75880 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: It's more recommended to use __PageMovable() to detect non-lru movable pages. We can avoid bumping page refcnt via isolate_movable_page() for the isolated lru pages. Also if pages become PageLRU just after they're checked but before trying to isolate them, isolate_lru_page() will be called to do the right work. Signed-off-by: Miaohe Lin Signed-off-by: Andrew Morton --- mm/memory-failure.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/memory-failure.c b/mm/memory-failure.c index a923a6dde871..3966fa6abe03 100644 --- a/mm/memory-failure.c +++ b/mm/memory-failure.c @@ -2404,7 +2404,7 @@ EXPORT_SYMBOL(unpoison_memory); static bool isolate_page(struct page *page, struct list_head *pagelist) { bool isolated = false; - bool lru = PageLRU(page); + bool lru = !__PageMovable(page); if (PageHuge(page)) { isolated = !isolate_hugetlb(page, pagelist);