From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) (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 912E437142 for ; Thu, 16 May 2024 08:45:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.187 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715849130; cv=none; b=hzCimQSF1Lgofyt4GkKoOUyNEY+DvmQtTCwR5sSRXLZ6XRTNP+YuhR0kTY94YP5PjOEdmQyveykYcVFezp402q7cJ0nXRrpXYQp6f5jKy5r0FkBRAKOfBSRHc+YBbUXMx0OGAU0GyHztjePcJ0cMDpwr+02E1lQKOdRNRHC1AbM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715849130; c=relaxed/simple; bh=7aYx2NAHJSdm6UY/JfxSDGIF/gJzItywug9/e9fWLng=; h=Subject:To:CC:References:From:Message-ID:Date:MIME-Version: In-Reply-To:Content-Type; b=dz7xbDpU//s7if2M5ZHa72oTGjpbqaQjkQSaz280r2V7u74HG4REVyN9B8eMOcaD5IePz/IUPjghrfuh0omhL55IgrAtyLCe9WLPApMUHN+Y2iOirlNB4ZcCG69qTIsSWvQRDjLuxgwKYBTgU9dUF0DaceebvAW7ZIPbHYhQ5Vw= 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.187 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.162.254]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4Vg3VN5cTSzxNgp; Thu, 16 May 2024 16:41:48 +0800 (CST) Received: from canpemm500002.china.huawei.com (unknown [7.192.104.244]) by mail.maildlp.com (Postfix) with ESMTPS id 8E42D1800C7; Thu, 16 May 2024 16:45:23 +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_256_GCM_SHA384) id 15.1.2507.35; Thu, 16 May 2024 16:45:23 +0800 Subject: Re: [PATCH v2] mm/huge_memory: don't unpoison huge_zero_folio To: Oscar Salvador , David Hildenbrand CC: , , , , , References: <20240515023607.870022-1-linmiaohe@huawei.com> From: Miaohe Lin Message-ID: Date: Thu, 16 May 2024 16:45:22 +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: dggems702-chm.china.huawei.com (10.3.19.179) To canpemm500002.china.huawei.com (7.192.104.244) On 2024/5/16 16:26, Oscar Salvador wrote: > On Wed, May 15, 2024 at 05:55:39PM +0200, David Hildenbrand wrote: >>> + if (is_huge_zero_folio(folio)) { >>> + unpoison_pr_info("Unpoison: huge zero page is not supported %#lx\n", >>> + pfn, &unpoison_rs); >>> + goto unlock_mutex; >>> + } >>> + > > Sorry for spamming your reply David, but for some unknown reason I am not able > to find the original patch in my mailbox, in none of the two accountes I am > subscribed, so I guess I will have to reply here. > > Just two things > > 1) We do not care if someone grabs a refcount for huge_zero_folio, > because since it is not supported anyway the outcome will not change. > Also, AFAIK, there is no chance we can unpoison that folio. > Therefore, I would just lift the check two blocks and place it right after > the hw_memory_failure check. > > 2) The whole thing is unsupported, but you will return -EBUSY while you > should be returning -EOPNOTSUPP AFAICS. > Thanks for your comment. Do you mean something like below? diff --git a/mm/memory-failure.c b/mm/memory-failure.c index 16ada4fb02b7..a9fe9eda593f 100644 --- a/mm/memory-failure.c +++ b/mm/memory-failure.c @@ -2546,6 +2546,13 @@ int unpoison_memory(unsigned long pfn) goto unlock_mutex; } + if (is_huge_zero_folio(folio)) { + unpoison_pr_info("Unpoison: huge zero page is not supported %#lx\n", + pfn, &unpoison_rs); + ret = -EOPNOTSUPP; + goto unlock_mutex; + } + if (!PageHWPoison(p)) { unpoison_pr_info("Unpoison: Page was already unpoisoned %#lx\n", pfn, &unpoison_rs); Thanks. . > with that you can add: > > Reviewed-by: Oscar Salvador > > >