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 3234FC2BBD4 for ; Sat, 12 Dec 2020 01:00:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1329423A7C for ; Sat, 12 Dec 2020 01:00:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390375AbgLKOLN (ORCPT ); Fri, 11 Dec 2020 09:11:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41626 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729979AbgLKOKR (ORCPT ); Fri, 11 Dec 2020 09:10:17 -0500 Received: from mail-pl1-x641.google.com (mail-pl1-x641.google.com [IPv6:2607:f8b0:4864:20::641]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 49789C06179C for ; Fri, 11 Dec 2020 06:09:20 -0800 (PST) Received: by mail-pl1-x641.google.com with SMTP id j1so4648811pld.3 for ; Fri, 11 Dec 2020 06:09:20 -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=SJUsAyZid8ZpUCO1A6kJYtQfMdu1p6LphB094f0w3bg=; b=Aj8ew0Hu3yHmTNKkdhjZ+X6b43SrHaczF4qZhuusrFL6cDfM/7VhTojRP/QDHzTBgT iDuj+C/tHmdYwmm3ovc+i3N17HKVh7cYSnCelcgWY6O35mMi2Hu2VjqHvqEp96zhjev4 bZF/f0upjqsusL81IM5qMfVkpPR8mmnU4STGZxHf6Lw68FsEjUq+PRoTZ1HtyxQysEyG fsawhedIjAPMW9279hsd3DFuGCQ+oKgIdwYrTdcM3PcFdVjVktEb/zZXpIwfIbkWAYOh ErnmdqTBkSBXpel99roVOLdClBLUeF3AUteTb4o7wLJdhlLKA+6IYVvPF3py6NLkTwBB 5WEw== 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=SJUsAyZid8ZpUCO1A6kJYtQfMdu1p6LphB094f0w3bg=; b=YXmT7ahuwJ7uDHThjcpwQ2KhYh5XQjuRjSfWQCyN3NdNh5PPad01iYW2ZKvcF1tO8V jUVOgzm3BIfLfY/k4KXjDZAh17jVlMiIrUrK5L+1FfvZy3l8857BhBXAoPewUcCeJskK dgHyS+Dl1vjWLb8NQDx4zsI6Eh5ZA40MaYK6w0K1qFzD3VnpEfXOWDErcWcjC9B6DFYz 8me6FwNPahym4H1e22IgJ7ZwTDoLO7OiqMH1hDOA+Xnc3n1o3Ahs5Vy0z/ZmkuzupzQO xbhyW5CRRkOjdlnQtJgOjnwMSui2UbH5Mj0AKZen4gh97m6E4YUGkvfA+6/CJezJBXhM c9yQ== X-Gm-Message-State: AOAM531z9mkhby9zBEzgKP8zX6p/pGSW75F8UpZ/CKuwRpQ4yMP3T6uD bhpWf+DPl2cFIBDunee1WzpECqVuVyRxZK4z8REG0w== X-Google-Smtp-Source: ABdhPJwrLNBJOldmJmyWaGlf9L4YnEd4a4zJ98KF8M3D+Gy0rq+4D6xov12z8j4f0zvZiLabKSGqTiyYXwKPUSSjrQM= X-Received: by 2002:a17:902:76c8:b029:d9:d6c3:357d with SMTP id j8-20020a17090276c8b02900d9d6c3357dmr11055737plt.34.1607695759816; Fri, 11 Dec 2020 06:09:19 -0800 (PST) MIME-Version: 1.0 References: <20201210035526.38938-1-songmuchun@bytedance.com> <20201210035526.38938-8-songmuchun@bytedance.com> <20201211133624.GA27050@linux> In-Reply-To: <20201211133624.GA27050@linux> From: Muchun Song Date: Fri, 11 Dec 2020 22:08:43 +0800 Message-ID: Subject: Re: [External] Re: [PATCH v8 07/12] mm/hugetlb: Set the PageHWPoison to the raw error 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 , Xiongchun duan , linux-doc@vger.kernel.org, LKML , Linux Memory Management List , linux-fsdevel Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Dec 11, 2020 at 9:36 PM Oscar Salvador wrote: > > On Thu, Dec 10, 2020 at 11:55:21AM +0800, Muchun Song wrote: > > +static inline void subpage_hwpoison_deliver(struct hstate *h, struct page *head) > > +{ > > + struct page *page = head; > > + > > + if (!free_vmemmap_pages_per_hpage(h)) > > + return; > > + > > + if (PageHWPoison(head)) > > + page = head + page_private(head + 4); > > + > > + /* > > + * Move PageHWPoison flag from head page to the raw error page, > > + * which makes any subpages rather than the error page reusable. > > + */ > > + if (page != head) { > > + SetPageHWPoison(page); > > + ClearPageHWPoison(head); > > + } > > +} > > I would make the names coherent. > I am not definitely goot at names, but something like: > hwpoison_subpage_{foo,bar} looks better. It's better than mine. Thank you. > > Also, could not subpage_hwpoison_deliver be rewritten like: > > static inline void subpage_hwpoison_deliver(struct hstate *h, struct page *head) > { > struct page *page; > > if (!PageHWPoison(head) || !free_vmemmap_pages_per_hpage(h)) > return; > > page = head + page_private(head + 4); > /* > * Move PageHWPoison flag from head page to the raw error page, > * which makes any subpages rather than the error page reusable. > */ > if (page != head) { > SetPageHWPoison(page); > ClearPageHWPoison(head); > } > } > > I think it is better code-wise. Will do. Thank you. > > > + * Move PageHWPoison flag from head page to the raw error page, > > + * which makes any subpages rather than the error page reusable. > > + */ > > + if (page != head) { > > + SetPageHWPoison(page); > > + ClearPageHWPoison(head); > > + } > > I would put this in an else-if above: > > if (free_vmemmap_pages_per_hpage(h)) { > set_page_private(head + 4, page - head); > return; > } else if (page != head) { > SetPageHWPoison(page); > ClearPageHWPoison(head); > } > > or will we lose the optimization in case free_vmemmap_pages_per_hpage gets compiled out? > Either is OK. The compiler will help us optimize the code when free_vmemmap_pages_per_hpage always returns false. Thanks for your suggestions. :-) > > -- > Oscar Salvador > SUSE L3 -- Yours, Muchun 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.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,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 B48B7C433FE for ; Fri, 11 Dec 2020 15:13:35 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id D83C522571 for ; Fri, 11 Dec 2020 15:13:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D83C522571 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 604556B0068; Fri, 11 Dec 2020 09:09:22 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 58D076B006C; Fri, 11 Dec 2020 09:09:22 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 47C9E6B006E; Fri, 11 Dec 2020 09:09:22 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0197.hostedemail.com [216.40.44.197]) by kanga.kvack.org (Postfix) with ESMTP id 2E6CE6B0068 for ; Fri, 11 Dec 2020 09:09:22 -0500 (EST) Received: from smtpin18.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id D937B8249980 for ; Fri, 11 Dec 2020 14:09:21 +0000 (UTC) X-FDA: 77581183722.18.class64_131146a27401 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin18.hostedemail.com (Postfix) with ESMTP id A5129100EC665 for ; Fri, 11 Dec 2020 14:09:21 +0000 (UTC) X-HE-Tag: class64_131146a27401 X-Filterd-Recvd-Size: 6291 Received: from mail-pj1-f66.google.com (mail-pj1-f66.google.com [209.85.216.66]) by imf34.hostedemail.com (Postfix) with ESMTP for ; Fri, 11 Dec 2020 14:09:21 +0000 (UTC) Received: by mail-pj1-f66.google.com with SMTP id v1so2248590pjr.2 for ; Fri, 11 Dec 2020 06:09:20 -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=SJUsAyZid8ZpUCO1A6kJYtQfMdu1p6LphB094f0w3bg=; b=Aj8ew0Hu3yHmTNKkdhjZ+X6b43SrHaczF4qZhuusrFL6cDfM/7VhTojRP/QDHzTBgT iDuj+C/tHmdYwmm3ovc+i3N17HKVh7cYSnCelcgWY6O35mMi2Hu2VjqHvqEp96zhjev4 bZF/f0upjqsusL81IM5qMfVkpPR8mmnU4STGZxHf6Lw68FsEjUq+PRoTZ1HtyxQysEyG fsawhedIjAPMW9279hsd3DFuGCQ+oKgIdwYrTdcM3PcFdVjVktEb/zZXpIwfIbkWAYOh ErnmdqTBkSBXpel99roVOLdClBLUeF3AUteTb4o7wLJdhlLKA+6IYVvPF3py6NLkTwBB 5WEw== 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=SJUsAyZid8ZpUCO1A6kJYtQfMdu1p6LphB094f0w3bg=; b=ryz3GcH+ZVNMKUWT1kHWeBLsWcNqMpnBOUzD+AvodqBPZPY7SkNw2l+GXKAjucBhva 5GYqOrIAvYLkmi9Wfdvg+PuMy2tYjlrtbXvz7189rA51Hgf6/09tk/PYE9rr4AWyrjVt nGLEL1wCKXMEuNFKWCEL5xWBlzy6k8/xiCzErwKqwmkTM5ukPSvyig13ci+9q59UwlSg pXtO0t3gLnIgCzrDHo8zEcgfXMj6sYwsMQoY7tFIxzMpL0eDk/gsP5pkjnizR0RAiycR Du9rsT2OWExTpxvzHpG9RjbHHRpMhivMmBJFFYP1c+kRW+JgwvExMg92p+lq7MkyfO05 hqjw== X-Gm-Message-State: AOAM5315G7VsxUENlbmB5ftyOK7p4+9m24JDLD8lebZZviU8ZYGe1/lE TsKHouPqDEw9baJFjt2iyiWsOHrfDXMMF/uTk07zrg== X-Google-Smtp-Source: ABdhPJwrLNBJOldmJmyWaGlf9L4YnEd4a4zJ98KF8M3D+Gy0rq+4D6xov12z8j4f0zvZiLabKSGqTiyYXwKPUSSjrQM= X-Received: by 2002:a17:902:76c8:b029:d9:d6c3:357d with SMTP id j8-20020a17090276c8b02900d9d6c3357dmr11055737plt.34.1607695759816; Fri, 11 Dec 2020 06:09:19 -0800 (PST) MIME-Version: 1.0 References: <20201210035526.38938-1-songmuchun@bytedance.com> <20201210035526.38938-8-songmuchun@bytedance.com> <20201211133624.GA27050@linux> In-Reply-To: <20201211133624.GA27050@linux> From: Muchun Song Date: Fri, 11 Dec 2020 22:08:43 +0800 Message-ID: Subject: Re: [External] Re: [PATCH v8 07/12] mm/hugetlb: Set the PageHWPoison to the raw error 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 , 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 11, 2020 at 9:36 PM Oscar Salvador wrote: > > On Thu, Dec 10, 2020 at 11:55:21AM +0800, Muchun Song wrote: > > +static inline void subpage_hwpoison_deliver(struct hstate *h, struct page *head) > > +{ > > + struct page *page = head; > > + > > + if (!free_vmemmap_pages_per_hpage(h)) > > + return; > > + > > + if (PageHWPoison(head)) > > + page = head + page_private(head + 4); > > + > > + /* > > + * Move PageHWPoison flag from head page to the raw error page, > > + * which makes any subpages rather than the error page reusable. > > + */ > > + if (page != head) { > > + SetPageHWPoison(page); > > + ClearPageHWPoison(head); > > + } > > +} > > I would make the names coherent. > I am not definitely goot at names, but something like: > hwpoison_subpage_{foo,bar} looks better. It's better than mine. Thank you. > > Also, could not subpage_hwpoison_deliver be rewritten like: > > static inline void subpage_hwpoison_deliver(struct hstate *h, struct page *head) > { > struct page *page; > > if (!PageHWPoison(head) || !free_vmemmap_pages_per_hpage(h)) > return; > > page = head + page_private(head + 4); > /* > * Move PageHWPoison flag from head page to the raw error page, > * which makes any subpages rather than the error page reusable. > */ > if (page != head) { > SetPageHWPoison(page); > ClearPageHWPoison(head); > } > } > > I think it is better code-wise. Will do. Thank you. > > > + * Move PageHWPoison flag from head page to the raw error page, > > + * which makes any subpages rather than the error page reusable. > > + */ > > + if (page != head) { > > + SetPageHWPoison(page); > > + ClearPageHWPoison(head); > > + } > > I would put this in an else-if above: > > if (free_vmemmap_pages_per_hpage(h)) { > set_page_private(head + 4, page - head); > return; > } else if (page != head) { > SetPageHWPoison(page); > ClearPageHWPoison(head); > } > > or will we lose the optimization in case free_vmemmap_pages_per_hpage gets compiled out? > Either is OK. The compiler will help us optimize the code when free_vmemmap_pages_per_hpage always returns false. Thanks for your suggestions. :-) > > -- > Oscar Salvador > SUSE L3 -- Yours, Muchun