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=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no 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 55428C433E0 for ; Thu, 11 Mar 2021 08:50:31 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id AF82D64FA9 for ; Thu, 11 Mar 2021 08:50:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AF82D64FA9 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 38A548D0298; Thu, 11 Mar 2021 03:50:30 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 3616C8D028E; Thu, 11 Mar 2021 03:50:30 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1DB968D0298; Thu, 11 Mar 2021 03:50:30 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0136.hostedemail.com [216.40.44.136]) by kanga.kvack.org (Postfix) with ESMTP id 0331B8D028E for ; Thu, 11 Mar 2021 03:50:29 -0500 (EST) Received: from smtpin26.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id B60E9181AF5C6 for ; Thu, 11 Mar 2021 08:50:29 +0000 (UTC) X-FDA: 77906972178.26.F4136A2 Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf19.hostedemail.com (Postfix) with ESMTP id 5EB9690009EA for ; Thu, 11 Mar 2021 08:50:27 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1615452628; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=RS6cifVwljfUL1yL0Nv+yv77FmIDhgMaVYQo3KVZdus=; b=F3hhneljDTvJKrt0QbK7pY8ctwitEc/6a9igJJkMYOrDmU1vpjL3JouXQ3oC7euzYAziYF 99p6iaQRqrBkw6qufEy72UIQbWYoP/WHk0/5jXowdxIZiej77vP3rv+j0Q2pm9EQObHfTL 6BZXhWnGJPPXx3CKD8FERYkK+VLwI9g= Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id C6AE5AD73; Thu, 11 Mar 2021 08:50:27 +0000 (UTC) Date: Thu, 11 Mar 2021 09:50:26 +0100 From: Michal Hocko To: Muchun Song Cc: Jonathan Corbet , Mike Kravetz , Thomas Gleixner , Ingo Molnar , bp@alien8.de, x86@kernel.org, hpa@zytor.com, dave.hansen@linux.intel.com, luto@kernel.org, Peter Zijlstra , Alexander Viro , Andrew Morton , paulmck@kernel.org, mchehab+huawei@kernel.org, pawan.kumar.gupta@linux.intel.com, Randy Dunlap , oneukum@suse.com, anshuman.khandual@arm.com, jroedel@suse.de, Mina Almasry , David Rientjes , Matthew Wilcox , Oscar Salvador , "Song Bao Hua (Barry Song)" , David Hildenbrand , HORIGUCHI =?utf-8?B?TkFPWUEo5aCA5Y+jIOebtOS5nyk=?= , Joao Martins , Xiongchun duan , linux-doc@vger.kernel.org, LKML , Linux Memory Management List , linux-fsdevel , Chen Huang , Bodeddula Balasubramaniam Subject: Re: [External] Re: [PATCH v18 5/9] mm: hugetlb: set the PageHWPoison to the raw error page Message-ID: References: <20210308102807.59745-1-songmuchun@bytedance.com> <20210308102807.59745-6-songmuchun@bytedance.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Stat-Signature: x5t38fg9gyao4u8rk7woixde8dz8mag1 X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 5EB9690009EA Received-SPF: none (suse.com>: No applicable sender policy available) receiver=imf19; identity=mailfrom; envelope-from=""; helo=mx2.suse.de; client-ip=195.135.220.15 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1615452627-941963 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 Thu 11-03-21 14:34:04, Muchun Song wrote: > On Wed, Mar 10, 2021 at 11:28 PM Michal Hocko wrote: > > > > On Mon 08-03-21 18:28:03, Muchun Song wrote: > > > Because we reuse the first tail vmemmap page frame and remap it > > > with read-only, we cannot set the PageHWPosion on some tail pages. > > > So we can use the head[4].private (There are at least 128 struct > > > page structures associated with the optimized HugeTLB page, so > > > using head[4].private is safe) to record the real error page index > > > and set the raw error page PageHWPoison later. > > > > Can we have more poisoned tail pages? Also who does consume that index > > and set the HWPoison on the proper tail page? > > Good point. I look at the routine of memory failure closely. > If we do not clear the HWPoison of the head page, we cannot > poison another tail page. > > So we should not set the destructor of the huge page from > HUGETLB_PAGE_DTOR to NULL_COMPOUND_DTOR > before calling alloc_huge_page_vmemmap(). In this case, > the below check of PageHuge() always returns true. > > I need to fix this in the previous patch. > > memory_failure() > if (PageHuge(page)) > memory_failure_hugetlb() > head = compound_head(page) > if (TestSetPageHWPoison(head)) > return I have to say that I am not fully familiar with hwpoisoning code (especially after recent changes) but IIRC it does rely on hugetlb page dissolving. With the new code this operation can fail which is a new situation. Unless I am misunderstanding this can lead to a lost memory failure operation on other tail pages. Anyway the above answers the question why a single slot is sufficient so it would be great to mention that in a changelog along with the caveat that some pages might miss their poisoning. -- Michal Hocko SUSE Labs