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=-3.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS 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 A0B92C433E0 for ; Sun, 7 Mar 2021 08:39:47 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 0A3B16511D for ; Sun, 7 Mar 2021 08:39:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0A3B16511D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=bytedance.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 81FBE6B005D; Sun, 7 Mar 2021 03:39:46 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 7CF806B006C; Sun, 7 Mar 2021 03:39:46 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 670256B006E; Sun, 7 Mar 2021 03:39:46 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0207.hostedemail.com [216.40.44.207]) by kanga.kvack.org (Postfix) with ESMTP id 4CED86B005D for ; Sun, 7 Mar 2021 03:39:46 -0500 (EST) Received: from smtpin30.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id F06AC2C9D for ; Sun, 7 Mar 2021 08:39:45 +0000 (UTC) X-FDA: 77892429930.30.53979EF Received: from mail-pj1-f47.google.com (mail-pj1-f47.google.com [209.85.216.47]) by imf27.hostedemail.com (Postfix) with ESMTP id 63CED80192DD for ; Sun, 7 Mar 2021 08:39:42 +0000 (UTC) Received: by mail-pj1-f47.google.com with SMTP id kx1so1436010pjb.3 for ; Sun, 07 Mar 2021 00:39:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=5+ZIdAEa9OwEkxgFcDiKNp4vM+KvSh13doJNbkRyCBk=; b=xhjBKjSuF4exEfCWDp7cl5chAnIppGTTfOErwDX9TjXEDszpoQHxnheS0lDw/Px0GD auYjkp6xPVobYtnb3S5RJvK1McAT4Kx8vX4xO0J6pWGev71nx7MLrRcp9ZqpAlqWMnk8 41yZTr35QJIAv3pOKBlvutH6ZCYXbZ15BFgpzWEx2GQ9Uan85hsZnr/bHfrhoWR3tJma m/nPKyAxWAJDS1igXcKnuHQqeOB5PMan3Ob/2UMVY0BpFi3ftw1E3U45qkzFTRrU9FYD +ykdzS8Ay9pxLZL1cZRHxyvyJaE+C2SsxklsIxZOcXdbIZMFb3GflqrqWxIcpuSctdqQ 3/mQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=5+ZIdAEa9OwEkxgFcDiKNp4vM+KvSh13doJNbkRyCBk=; b=Dn0WgnUs4bat3SxlUFKHydiWW5nOxwhHUM/Rt2elePPZwCH2ZGwTD0nYv2dwgYHkHM Mw6iXGk9E+FlKvAqR9eB6Y1FEgCdHQmLs22H6wB5gSz6wcJu/QMsDOQ/vJ3tR808b3Un yOp+sgP9GCxi4ZFoFUtU2jBz7BqqBdisuqAFPywlH4e2BAkse1U4194b9yLQOXKAYJWL Sc3caCEMZNZeQg6sAanOguZKD3gFogEgFFMwSk9iT7veDUyBgMGT+eEyqlYsQHmXCNuR D/pDHiaxmGZtdY9Ryk0YroFqMHwC5AbNJGEwUrI7uXhtqHCT6LifF0ofMsWIM8iJPtO8 mGXA== X-Gm-Message-State: AOAM531MVtLyaSn0gWbqkQHZBFrikrItzhTK4phUKhBTTZRxbLqPk7m0 Uh38Qub2mW8mbjIS9JAehnU7CKJxiWHrGuseMZMYSg== X-Google-Smtp-Source: ABdhPJzYu4GAe2KZbj6JGQ3TjLW4bhjtDiKLF8LYik5ilaN940EpS0CUXvYX1AmTwVvRaeE70SCqKvP8wVhLrFQc8B8= X-Received: by 2002:a17:90a:778a:: with SMTP id v10mr18672246pjk.229.1615106383749; Sun, 07 Mar 2021 00:39:43 -0800 (PST) MIME-Version: 1.0 References: <20210225132130.26451-1-songmuchun@bytedance.com> <20210225132130.26451-6-songmuchun@bytedance.com> <20210307081857.GE1223287@balbir-desktop> In-Reply-To: <20210307081857.GE1223287@balbir-desktop> From: Muchun Song Date: Sun, 7 Mar 2021 16:39:07 +0800 Message-ID: Subject: Re: [External] Re: [PATCH v17 5/9] mm: hugetlb: set the PageHWPoison to the raw error page To: Balbir Singh 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 , Michal Hocko , "Song Bao Hua (Barry Song)" , David Hildenbrand , =?UTF-8?B?SE9SSUdVQ0hJIE5BT1lBKOWggOWPoyDnm7TkuZ8p?= , Joao Martins , Xiongchun duan , linux-doc@vger.kernel.org, LKML , Linux Memory Management List , linux-fsdevel Content-Type: text/plain; charset="UTF-8" X-Stat-Signature: oigqc7rmgcjiexzhkiirhg7t7s5r6i1x X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 63CED80192DD Received-SPF: none (bytedance.com>: No applicable sender policy available) receiver=imf27; identity=mailfrom; envelope-from=""; helo=mail-pj1-f47.google.com; client-ip=209.85.216.47 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1615106382-208682 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 Sun, Mar 7, 2021 at 4:19 PM Balbir Singh wrote: > > On Thu, Feb 25, 2021 at 09:21:26PM +0800, 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. > > > > Does the hardcoding of 4 come from HUGETLB_CGROUP_MIN_ORDER, if so Yes. > do we need to hardcode 4? Also, I am not sure about the comment > on safety and 128 struct pages We can set head[4].private only if free_vmemmap_pages_per_hpage(h) returns true. In this case, there are 128 struct page structures (we reserve 2 pages as vmemmap pages, so 2 * 4KB / sizeof(struct page) == 128) that can be used. Instead of hardcode, I introduce another patch to make the code more readable. Please refer to patch #8 in this series. Thanks. > > Balbir >