Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp243144pxf; Wed, 17 Mar 2021 21:49:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy/wC71V6IElzq2BkYvGgw2iasmSwHHCLKOZimajRwIkbX3hB9SmRAt6GRxZFt13mNb6hnc X-Received: by 2002:a17:907:20f5:: with SMTP id rh21mr39056294ejb.27.1616042940262; Wed, 17 Mar 2021 21:49:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616042940; cv=none; d=google.com; s=arc-20160816; b=0czWjkTkOKAv7L2hqIeIDg2JfaTNlk0PLpWieLepKTKhAyxj9o61T5bgdiv9a6ddER oL7p+zIbXI0mlXeZPVFuRRZzsKJItd3SBLrbiJ/mf+LQvbspszsCUYcq/4sja6SglhmO aTIMR4mAEIGrZhzqOC33K36KjJCJc+UfTdBc/61K1QD2myoB9znf4IvizFTRuTdfwe8v LOvIN6GNkZhIJ64BY6zI8CZN2a0YRVcCiFsTUYM1o2xW63lcJq1AzjzTchlAbk+nIJ1X O3ivN3N3sWVhD+gEEiDGPAaVS3muxkd+pmfrJt6WLaHYqDOAJqc1LYwJodj5pdwu775B 7uMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=F93ivzjYDpHgoLKqz/Drlvs5EXIlgslgFHl2ysODhqY=; b=gkGFjdMWdbU4oie9F1AFhhPiP1mad3UghbVS3o125qBpq5VxenI5r5j/7vRp60qtt8 7rl7DR5RfAtyYcAxWvyNgZq8dfMG5gOQ3eN5RjLF2PL4Xic48v32L+PvvkvDS0RPhFLd cTp7J9xjP/WY7teizAsPPptgANxbP75bVB57cRorbvi3/ZN5lGIYvqSIEJ0/4SZiTCKk rb9TAQNdghl63hvUUpg/V3SAhuKwxVu30I9MY/WKtv0fuh9rZfZmf5ClcgEJm2hRGGTH NaH38tY+vlLebrwOYxxOzdiyC4SGwkZ6TfFqkDzToksAbgs6pDUFLaEcGPyzh9DJuCwo 8Y2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b="TTc9/ePO"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s11si684925edd.147.2021.03.17.21.48.38; Wed, 17 Mar 2021 21:49:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b="TTc9/ePO"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229654AbhCREqz (ORCPT + 99 others); Thu, 18 Mar 2021 00:46:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41896 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229598AbhCREqx (ORCPT ); Thu, 18 Mar 2021 00:46:53 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 81DEBC06174A for ; Wed, 17 Mar 2021 21:46:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=F93ivzjYDpHgoLKqz/Drlvs5EXIlgslgFHl2ysODhqY=; b=TTc9/ePOh7n5qN3ogFUpZ0TSFj iNcQPGs9OgTvFhNzCFN5skhEb70V1Mlf7JbB60NYv1m33UgkkGMEbgBLow1c7yLw8fMqNnYvM9Wqv Xd9vfGJjHZpjejsVVhdOjd9udpgKoai5zzp/PL6umPKoU2Tw4eixcSaDr/CR3fch6QGvdw7oktJM7 L7eLnAFY2+KUSNLU9LzcZqOzzR8MNbVi6Wxf2Ui8dX1bv3SmWhjV9U+E818WRLwArboaWByKo1d/n T/5n/FO6EG45KEY7v/njCRc3LJPxuXekh1lIhaitwT4fihmw9c1OGCxF6jS43cxO5hLgOGIkv2l07 qdzwNjwA==; Received: from willy by casper.infradead.org with local (Exim 4.94 #2 (Red Hat Linux)) id 1lMkXo-002YSO-Rt; Thu, 18 Mar 2021 04:46:06 +0000 Date: Thu, 18 Mar 2021 04:46:00 +0000 From: Matthew Wilcox To: David Hildenbrand Cc: Aili Yao , akpm@linux-foundation.org, naoya.horiguchi@nec.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, yangfeng1@kingsoft.com, sunhao2@kingsoft.com, Oscar Salvador , Mike Kravetz Subject: Re: [PATCH] mm/gup: check page posion status for coredump. Message-ID: <20210318044600.GJ3420@casper.infradead.org> References: <20210317163714.328a038d@alex-virtual-machine> <20a0d078-f49d-54d6-9f04-f6b41dd51e5f@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20a0d078-f49d-54d6-9f04-f6b41dd51e5f@redhat.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 17, 2021 at 10:12:02AM +0100, David Hildenbrand wrote: > > + if (IS_ENABLED(CONFIG_MEMORY_FAILURE) && ret == 1) { > > + if (unlikely(PageHuge(page) && PageHWPoison(compound_head(page)))) > > + ret = 0; > > + else if (unlikely(PageHWPoison(page))) > > + ret = 0; > > + } > > I wonder if a simple > > if (PageHWPoison(compound_head(page))) > ret = 0; > > won't suffice. But I guess the "issue" is compound pages that are not huge > pages or transparent huge pages. THPs don't set the HWPoison bit on the head page. https://lore.kernel.org/linux-mm/20210316140947.GA3420@casper.infradead.org/ (and PAGEFLAG(HWPoison, hwpoison, PF_ANY)) By the way, #ifdef CONFIG_MEMORY_FAILURE PAGEFLAG(HWPoison, hwpoison, PF_ANY) TESTSCFLAG(HWPoison, hwpoison, PF_ANY) #define __PG_HWPOISON (1UL << PG_hwpoison) extern bool take_page_off_buddy(struct page *page); #else PAGEFLAG_FALSE(HWPoison) #define __PG_HWPOISON 0 #endif so there's no need for this if (IS_ENABLED(CONFIG_MEMORY_FAILURE) check, as it simply turns into if (PageHuge(page) && 0) else if (0) and the compiler can optimise it all away.