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=-8.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham 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 72FC0C4361B for ; Fri, 18 Dec 2020 09:42:07 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id EF62423A84 for ; Fri, 18 Dec 2020 09:42:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EF62423A84 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 31E6D6B005C; Fri, 18 Dec 2020 04:42:06 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 2CE636B005D; Fri, 18 Dec 2020 04:42:06 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1E4DC6B0068; Fri, 18 Dec 2020 04:42:06 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0130.hostedemail.com [216.40.44.130]) by kanga.kvack.org (Postfix) with ESMTP id 099BF6B005C for ; Fri, 18 Dec 2020 04:42:06 -0500 (EST) Received: from smtpin24.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id B2D27999F for ; Fri, 18 Dec 2020 09:42:05 +0000 (UTC) X-FDA: 77605911810.24.smoke46_2f0eb342743c Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin24.hostedemail.com (Postfix) with ESMTP id 8EA571A4A0 for ; Fri, 18 Dec 2020 09:42:05 +0000 (UTC) X-HE-Tag: smoke46_2f0eb342743c X-Filterd-Recvd-Size: 5733 Received: from mail-pg1-f182.google.com (mail-pg1-f182.google.com [209.85.215.182]) by imf46.hostedemail.com (Postfix) with ESMTP for ; Fri, 18 Dec 2020 09:42:04 +0000 (UTC) Received: by mail-pg1-f182.google.com with SMTP id v29so966442pgk.12 for ; Fri, 18 Dec 2020 01:42:04 -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=Pqqg8DDqW0mYjxSRT2ri8wFtsthaAPGXwdPj8g0F1AM=; b=qQsxvCxsK5tYahBEkEGFTy+EGjEclNaaIU2qx50C9G6MvIXlWULspeHYmmaCiqsSvy 19Fx7fbCVuSmNGp4VYK9bg/sero4jC6yP4BsHz2dMgiOAhSDmR9PnUQ+r+mnIpdMhe1s y8WKc4stNLOllpzlUKAPd6N1sxYtjtYR+BgvhnofZ0luUR39sXhjueW4phwDZlfbLT20 feJkPbLxIQge7SV9dMweCaGG9VajK0LVj0nR7s82uMi4jUliFp3/oRK+dXDNpOn6sVeb 9XonvaeSdu+/lktpb/NGH5vqd3yHkDyKt/phhL/f8pzoSmb1IgruCMdX0uhnjCWj04eW PN1A== 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=Pqqg8DDqW0mYjxSRT2ri8wFtsthaAPGXwdPj8g0F1AM=; b=lXk8hmlPMNiLrxdS9LTno2rGECXDShz9T3rDN2fUUBDyLV0GAnFeHQ6Q/gOfIfk5yl zdJVbjzf5lQFl/2giucZLjGLUlmWaZZ88dcvR+J5n21Cic8MdYnRaEYCFWIqbMBFBWs+ ad9xlGjjMZz4C18GmXIj/JAcVM/WPC+Xowmp7/aw/aX1tDR3VhipJyOk1KDR7QoNbB3p x5tckGK8pZgBzm+RGr0ncwm0ASkzafvKig0+hgxeXjVP81rJ7jkEDFG216vqUuy0IPzr /56ZUSV9l8LnK9z/Lkm9PQgSPpoFdVyFq4UKRzo7zJk/pCnvQGJ7e5QP9oC0K2OjF207 3mEA== X-Gm-Message-State: AOAM533Nmnry8wj4f4e57mBP1h7p1aMyjPtQ1Sjd+d2/YUYcvOXPZWH5 Qo4Jy+DHSF8v3GaFOTcOfVUvFNR3l1djcrQDsJGr2A== X-Google-Smtp-Source: ABdhPJx2YShUHAdmKlbD92/q4ID8magiF7CQMaMINDxCXVqJQV0vu71BObO+Mx6j5v7VeR91fgNZ+3CY/NCm9NVn2fo= X-Received: by 2002:aa7:8701:0:b029:19e:561:d476 with SMTP id b1-20020aa787010000b029019e0561d476mr3558941pfo.2.1608284523546; Fri, 18 Dec 2020 01:42:03 -0800 (PST) MIME-Version: 1.0 References: <20201217121303.13386-1-songmuchun@bytedance.com> <20201217121303.13386-11-songmuchun@bytedance.com> <20201218090631.GA3623@localhost.localdomain> In-Reply-To: <20201218090631.GA3623@localhost.localdomain> From: Muchun Song Date: Fri, 18 Dec 2020 17:41:24 +0800 Message-ID: Subject: Re: [External] Re: [PATCH v10 10/11] mm/hugetlb: Gather discrete indexes of tail page To: Oscar Salvador Cc: Jonathan Corbet , Mike Kravetz , Thomas Gleixner , mingo@redhat.com, bp@alien8.de, x86@kernel.org, hpa@zytor.com, dave.hansen@linux.intel.com, luto@kernel.org, Peter Zijlstra , viro@zeniv.linux.org.uk, 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 , Michal Hocko , "Song Bao Hua (Barry Song)" , David Hildenbrand , naoya.horiguchi@nec.com, Xiongchun duan , linux-doc@vger.kernel.org, LKML , Linux Memory Management List , linux-fsdevel Content-Type: text/plain; charset="UTF-8" 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 Fri, Dec 18, 2020 at 5:06 PM Oscar Salvador wrote: > > On Thu, Dec 17, 2020 at 08:13:02PM +0800, Muchun Song wrote: > > diff --git a/mm/hugetlb.c b/mm/hugetlb.c > > index 6c02f49959fd..78dd88dda857 100644 > > --- a/mm/hugetlb.c > > +++ b/mm/hugetlb.c > > @@ -1360,7 +1360,7 @@ static inline void hwpoison_subpage_deliver(struct hstate *h, struct page *head) > > if (!PageHWPoison(head) || !free_vmemmap_pages_per_hpage(h)) > > return; > > > > - page = head + page_private(head + 4); > > + page = head + page_private(head + SUBPAGE_INDEX_HWPOISON); > > > > /* > > * Move PageHWPoison flag from head page to the raw error page, > > @@ -1379,7 +1379,7 @@ static inline void hwpoison_subpage_set(struct hstate *h, struct page *head, > > return; > > > > if (free_vmemmap_pages_per_hpage(h)) { > > - set_page_private(head + 4, page - head); > > + set_page_private(head + SUBPAGE_INDEX_HWPOISON, page - head); > > Ok, I was too eager here. > > If CONFIG_HUGETLB_PAGE_FREE_VMEMMAP is not set for whatever reason > (e.g: CONFIG_MEMORY_HOTREMOVE is disabled), when you convert "+4" > to its index (SUBPAGE_INDEX_HWPOISON), this will no longer build > since we only define SUBPAGE_INDEX_HWPOISON when the config > option CONFIG_HUGETLB_PAGE_FREE_VMEMMAP is set. Yeah, it is my mistake. Thanks for pointing that out. > > Different things can be done to fix this: > > e.g: > > - Define a two different hwpoison_subpage_{deliver,set} > and have them under > #ifdef CONFIG_HUGETLB_PAGE_FREE_VMEMMAP > ... > #else > ... > #endif > > - Work it around as is with IS_ENABLED(CONFIG_HUGETLB_... > - Have a common entry and decide depending on whether > the config is enabled. > > I guess option #1 might be cleaner. Thanks for your suggestion. I also prefer option #1. > > -- > Oscar Salvador > SUSE L3 -- Yours, Muchun