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 82C7AC433FE for ; Sat, 8 Oct 2022 02:34:00 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E85846B0072; Fri, 7 Oct 2022 22:33:59 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E35CC6B0073; Fri, 7 Oct 2022 22:33:59 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CFD8A6B0074; Fri, 7 Oct 2022 22:33:59 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id B98566B0072 for ; Fri, 7 Oct 2022 22:33:59 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 8551480109 for ; Sat, 8 Oct 2022 02:33:59 +0000 (UTC) X-FDA: 79996212198.13.A5642A1 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf22.hostedemail.com (Postfix) with ESMTP id BAF21C0023 for ; Sat, 8 Oct 2022 02:33:58 +0000 (UTC) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.54]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4Mkpyg25mxzHtv1; Sat, 8 Oct 2022 10:28:59 +0800 (CST) Received: from [10.174.151.185] (10.174.151.185) 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.31; Sat, 8 Oct 2022 10:33:54 +0800 Subject: Re: [PATCH v3 1/4] mm,hwpoison,hugetlb,memory_hotplug: hotremove memory section with hwpoisoned hugepage To: =?UTF-8?B?SE9SSUdVQ0hJIE5BT1lBKOWggOWPoyDnm7TkuZ8p?= CC: Naoya Horiguchi , "linux-mm@kvack.org" , Andrew Morton , David Hildenbrand , Mike Kravetz , Yang Shi , Oscar Salvador , Muchun Song , Jane Chu , "linux-kernel@vger.kernel.org" References: <20220921091359.25889-1-naoya.horiguchi@linux.dev> <20220921091359.25889-2-naoya.horiguchi@linux.dev> <91a4759f-88e4-f9ac-aff5-41d2db5ecfdd@huawei.com> <20220928012647.GA597297@u2004.lan> <20221007004501.GA3227576@hori.linux.bs1.fc.nec.co.jp> From: Miaohe Lin Message-ID: <87ca9ce8-46bb-0b3e-2c84-aa24c0bad555@huawei.com> Date: Sat, 8 Oct 2022 10:33:54 +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: <20221007004501.GA3227576@hori.linux.bs1.fc.nec.co.jp> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 8bit X-Originating-IP: [10.174.151.185] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=none; spf=pass (imf22.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.188 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=1665196439; a=rsa-sha256; cv=none; b=eJGCiiLm1kHwB0bbqlPRDHHf3TvZwnwo/zKrB7CNxNLnCeKpkixgy37XjaVsoMDB+fMiVV nr0PqSDTNHhAlgsY0HAHXwg8D8DoglAEFFOPB2L8CvzJnIRtESQn1xgvDSLGx2bBPa4sz7 f6S0m2qdAarCDXw6V1U654WQWFN/6sM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1665196439; 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=I/hV1aFLS30ifHvCf76M1McDDXuHWTqMOhoaq49hgeM=; b=zxPbF9jPzjQiHnSV1hzijzV3A/7uj5Um/nzocCHQftPP2Nt1eHDxs+fpYdh1ak2Fhbwe4L UqIYuhqq3tasl2VdhaYSgEs5tHANddIPC2xwwRHcYP7uUNr5vnzaMRO5WFz+cxMM9puYVO pBHV6P623vL2zsf3bIwfTmIcn1ChNYA= X-Rspamd-Queue-Id: BAF21C0023 X-Rspam-User: Authentication-Results: imf22.hostedemail.com; dkim=none; spf=pass (imf22.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com X-Rspamd-Server: rspam10 X-Stat-Signature: pwpmr1ef5836p4dc4gacijx9bxqbk9ws X-HE-Tag: 1665196438-773230 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/10/7 8:45, HORIGUCHI NAOYA(堀口 直也) wrote: > On Wed, Sep 28, 2022 at 05:32:12PM +0800, Miaohe Lin wrote: >> On 2022/9/28 9:26, Naoya Horiguchi wrote: >>>>> @@ -1815,6 +1815,13 @@ int __get_huge_page_for_hwpoison(unsigned long pfn, int flags) > ... >>>>> @@ -1862,6 +1869,7 @@ static int try_memory_failure_hugetlb(unsigned long pfn, int flags, int *hugetlb >>>>> >>>>> if (hwpoison_filter(p)) { >>>>> hugetlb_clear_page_hwpoison(head); >>>>> + SetHPageMigratable(head); >>>> >>>> Would we set HPageMigratable flag for free hugetlb pages here? IIUC, they're not expected to have this flag set. >>> >>> Thank you, you're right. This should be done in "if (res == 1)" block. >> >> If res == 1, it means hugetlb page refcnt is incremented. But it seems this does not necessarily mean >> HPageMigratable is cleared by __get_huge_page_for_hwpoison() if the hugetlb page is already isolated. >> If so, we might set HPageMigratable flag back for already isolated hugetlb pages? > > # sorry for my late reply, I was busy with personal matters these days... That's all right. I was back from my vacation too. Thanks for your work. :) > > Yes, that could happen (and also in the case where MF_COUNT_INCREASED is > set). We need store whether HPageMigratable flag is cleared or not in > __get_huge_page_for_hwpoison(). I'll add a parameter to > __get_huge_page_for_hwpoison() to return the flag change to the caller. > But I also think that there're a few internal states during error handling, > so it might be good to add some structure like "struct hwpoison_control" > to save such internal states over related functions (not in this series). That sounds like a good idea. Thanks, Miaohe Lin > > Thanks, > Naoya Horiguchi >