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=-10.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham 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 6B962C48BE8 for ; Wed, 16 Jun 2021 00:41:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 56E8061107 for ; Wed, 16 Jun 2021 00:41:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231795AbhFPAnU (ORCPT ); Tue, 15 Jun 2021 20:43:20 -0400 Received: from mail-m118208.qiye.163.com ([115.236.118.208]:30706 "EHLO mail-m118208.qiye.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231772AbhFPAnO (ORCPT ); Tue, 15 Jun 2021 20:43:14 -0400 Received: from [0.0.0.0] (unknown [116.24.56.76]) by mail-m118208.qiye.163.com (Hmail) with ESMTPA id 944CEE0193; Wed, 16 Jun 2021 08:41:04 +0800 (CST) Subject: Re: [PATCH v1 2/6] mm/hwpoison: remove race consideration To: =?UTF-8?B?SE9SSUdVQ0hJIE5BT1lBKOWggOWPoyDnm7TkuZ8p?= Cc: Naoya Horiguchi , "linux-mm@kvack.org" , Andrew Morton , David Hildenbrand , Oscar Salvador , Michal Hocko , Tony Luck , "Aneesh Kumar K.V" , "linux-kernel@vger.kernel.org" References: <20210614021212.223326-1-nao.horiguchi@gmail.com> <20210614021212.223326-3-nao.horiguchi@gmail.com> <25c69dc8-0ce2-8330-dfb0-506481dc9a53@sangfor.com.cn> <20210616001141.GA1924716@hori.linux.bs1.fc.nec.co.jp> From: Ding Hui Message-ID: <7b8f576b-b61b-ad68-c84b-476c96f89156@sangfor.com.cn> Date: Wed, 16 Jun 2021 08:40:58 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <20210616001141.GA1924716@hori.linux.bs1.fc.nec.co.jp> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-HM-Spam-Status: e1kfGhgUHx5ZQUtXWQgYFAkeWUFZS1VLWVdZKFlBSE83V1ktWUFJV1kPCR oVCBIfWUFZQh1JGFYeTU4dTx5PQ0hPGktVEwETFhoSFyQUDg9ZV1kWGg8SFR0UWUFZT0tIVUpKS0 hKQ1VLWQY+ X-HM-Sender-Digest: e1kMHhlZQR0aFwgeV1kSHx4VD1lBWUc6OFE6Qgw4HT8LTk8QKkw2EwI3 KxgwFENVSlVKTUlIQ0tPS01MSENCVTMWGhIXVR8SFRwTDhI7CBoVHB0UCVUYFBZVGBVFWVdZEgtZ QVlKSk1VSU9VTk1VTE1ZV1kIAVlBSEJCQjcG X-HM-Tid: 0a7a1243bd0f2c17kusn944cee0193 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2021/6/16 8:11, HORIGUCHI NAOYA(堀口 直也) wrote: > On Tue, Jun 15, 2021 at 08:57:06PM +0800, Ding Hui wrote: >> On 2021/6/14 10:12, Naoya Horiguchi wrote: >>> @@ -1956,17 +1938,6 @@ int unpoison_memory(unsigned long pfn) >>> goto unlock_mutex; >>> } >>> - /* >>> - * unpoison_memory() can encounter thp only when the thp is being >>> - * worked by memory_failure() and the page lock is not held yet. >>> - * In such case, we yield to memory_failure() and make unpoison fail. >>> - */ >>> - if (!PageHuge(page) && PageTransHuge(page)) { >>> - unpoison_pr_info("Unpoison: Memory failure is now running on %#lx\n", >>> - pfn, &unpoison_rs); >>> - goto unlock_mutex; >>> - } >>> - >> >> if a huge page is in process of alloc or free, HUGETLB_PAGE_DTOR can be set >> after __SetPageHead() or be cleared before __ClearPageHead(), so this >> condition may be true in racy. > > Hi Ding, > > We confirm PageHWPoison() before reaching this if-block and hwpoisoned pages > are prohibited from allocation, so it seems to me that this check never > races with hugetlb allocation. > > And according to the original patch introduced this if-block (0cea3fdc416d: > "mm/hwpoison: fix race against poison thp"), this if-block intended to close > the race between memory_failure() and unpoison_memory(), so that's no longer > necessary due to mf_mutex. > I got it and thanks for your explanation. >> Do we need the racy test for this situation? > > I'm not sure, but I think that we need more stress/fuzz testing focusing on > this subsystem, and "unpoison vs allocation" race can be covered in the topic. > > Thank you, > Naoya Horiguchi > -- Thanks, - Ding Hui