Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp710186pxb; Wed, 13 Jan 2021 14:11:38 -0800 (PST) X-Google-Smtp-Source: ABdhPJyVCmlK4NoM4Tv+rKHa2kSV35YptGuznfo5ZfC6s9G4Trh/xrGoWHdj+wfPZh+FlDt+/dRz X-Received: by 2002:a17:906:d1cb:: with SMTP id bs11mr2929630ejb.535.1610575898270; Wed, 13 Jan 2021 14:11:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610575898; cv=none; d=google.com; s=arc-20160816; b=b/B/oxra9SE9ZuRKW2d/qkDQhjRRI3gHUzLBJA64g6L9Qfq3QIyaC+8KZm7xgWiXhE x1mLg//Hib7nj66p16a0NBOLDAg0Idua5WviezVSsFnWygxiP1Yn6M+gXDn8yrvi5HM5 mkINQkD0Gvj2jaDtpZi8Pi7Tlg6MvCyAh7AbwXwNItVVB6xSM/ttL74k2tUZIcaQe0Sy vhy2N42NANTRAjzsOmlAyPEkfzHcbVqrgUvL5it/W6AemPtFjjDjRp5qf1pRJRR/qQIF 17qMUr46bBFM0VS4ws4i+kOqAG4msZAHyFqyrhuO0gxfyuC3UXu7SO842m4AFEdCS7sv PXXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=tkCEm6n1O2YDsdNDXJh8BIEgy3kecFF0HQkrvLtX2UM=; b=ngKWdLUnldrSKCq9lTBFqP48nJwTLjHI75GQi/DZLopMcop7TdbIYsQI0FUPIJNeDd jbCxGB5GCWy1vWsL+5CGb55Lq405CVOesJpklXGjjuCmk38X2atQqPM/kq2Z2A585Vt+ Lpv7yDDGMcHBJvBfMDWgbKzL6v6ROYbM5vWUWNo3My37CAZ90qbvoG08cW4Xa2L6qUWQ 60DrEaAbS8GY2OCagw5q3Jx1iOPn1hhMHEgIWzNgibaCikET1qqNXTAk/S6Hm7n3ikF7 WbDF4B8hTftgtiB/qH5n/fdTpaoRpSWdfc0jKfvYqNdgy/nBRuPwJxtgTM+5SEErNota Gakw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b=SRVHAUkp; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a89si1629498edf.215.2021.01.13.14.11.14; Wed, 13 Jan 2021 14:11:38 -0800 (PST) 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=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b=SRVHAUkp; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729241AbhAMWD1 (ORCPT + 99 others); Wed, 13 Jan 2021 17:03:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49806 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729229AbhAMWAf (ORCPT ); Wed, 13 Jan 2021 17:00:35 -0500 Received: from mail-ed1-x532.google.com (mail-ed1-x532.google.com [IPv6:2a00:1450:4864:20::532]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 20E34C061786 for ; Wed, 13 Jan 2021 13:52:25 -0800 (PST) Received: by mail-ed1-x532.google.com with SMTP id r5so3543709eda.12 for ; Wed, 13 Jan 2021 13:52:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=tkCEm6n1O2YDsdNDXJh8BIEgy3kecFF0HQkrvLtX2UM=; b=SRVHAUkpjdzGINze2D0SPtwgt3b82Lz/3p99J6k6sZtsuYKAjn5691k8Rp8b7FUCS9 6Rl0wbuf5DR1iOh0Bu8H2VEZHjnIko2IpIeXpeyK7UoEOQcvVEg5ATgpU7ILN8FvrLOJ tU3S5Kbj9+NbosbQygaXJCjPhAON9p+WjNYl7vNEwbEZCP9WYe8jbt/lceuyN/JtZNF5 +lFs1SUeHRZFbP1fqinWUwwE0BMOo8UJwXrlPxyWIiOOAWjRy+q03pNsCcP6kNzLLcBO RuItbDUV2Wl4/PPqfv0rryUy9n2oc//db/8GySCvN+q/K5oHMfeMYIBqGtgHAkGv+XnY d9Pw== 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=tkCEm6n1O2YDsdNDXJh8BIEgy3kecFF0HQkrvLtX2UM=; b=Xrb+Kml+FyDhEbPGgFSvvpApgcBc8IHBPMGgT1GcQKTWs+qCnvuhxh8LIH0m55/zLu ZGt0pw4KNrexuRtWuXPBYpc0S8gDUkS7Lef9YHfqoKICL9OJI8wy5FMBlfcj2WP6lFLH rRgGhKT6Cu6CQJyMSxtrcveTvJdm+ESK0Bx9AXsybXqzrzb7raUcEeRFrglmTHcaym/4 tcnfR7iotET8i1JKxA5KbOxxYE2NfQwIv62ayrrd+RStdJFYL1OFXWyeCrtiXfGlrtIf UrbWFjHn8Jeqku2qC621WK7iHNJnbfWZLQ1Qr1l+E1n+VuwhlRaVqvBPW44s6jUvFrJA wc+A== X-Gm-Message-State: AOAM533IGiiktxmG9YiP/TC9Fn+Efd2DNTPBt/gnFuecvAUWntO+7yGv K3wikLAqzxDXGEKBx1h+9L8lftwODZdNXtCOO/lVlg== X-Received: by 2002:aa7:c3cd:: with SMTP id l13mr3362518edr.97.1610574743900; Wed, 13 Jan 2021 13:52:23 -0800 (PST) MIME-Version: 1.0 References: <161052331545.1805594.2356512831689786960.stgit@dwillia2-desk3.amr.corp.intel.com> <161052332755.1805594.9846390935351758277.stgit@dwillia2-desk3.amr.corp.intel.com> <230efa36-9192-fe52-b8b6-16b2feafb70b@redhat.com> In-Reply-To: <230efa36-9192-fe52-b8b6-16b2feafb70b@redhat.com> From: Dan Williams Date: Wed, 13 Jan 2021 13:52:14 -0800 Message-ID: Subject: Re: [PATCH v3 2/6] mm: Teach pfn_to_online_page() to consider subsection validity To: David Hildenbrand Cc: Linux MM , Qian Cai , Michal Hocko , Oscar Salvador , Vishal L Verma , linux-nvdimm , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jan 13, 2021 at 12:29 AM David Hildenbrand wrote: > > On 13.01.21 08:35, Dan Williams wrote: > > pfn_section_valid() determines pfn validity on subsection granularity > > where pfn_valid() may be limited to coarse section granularity. > > Explicitly validate subsections after pfn_valid() succeeds. > > > > Fixes: b13bc35193d9 ("mm/hotplug: invalid PFNs from pfn_to_online_page()") > > Cc: Qian Cai > > Cc: Michal Hocko > > Cc: Oscar Salvador > > Reported-by: David Hildenbrand > > Signed-off-by: Dan Williams > > --- > > mm/memory_hotplug.c | 24 ++++++++++++++++++++---- > > 1 file changed, 20 insertions(+), 4 deletions(-) > > > > diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c > > index 55a69d4396e7..9f37f8a68da4 100644 > > --- a/mm/memory_hotplug.c > > +++ b/mm/memory_hotplug.c > > @@ -308,11 +308,27 @@ static int check_hotplug_memory_addressable(unsigned long pfn, > > struct page *pfn_to_online_page(unsigned long pfn) > > { > > unsigned long nr = pfn_to_section_nr(pfn); > > + struct mem_section *ms; > > + > > + if (nr >= NR_MEM_SECTIONS) > > + return NULL; > > + > > + ms = __nr_to_section(nr); > > + if (!online_section(ms)) > > + return NULL; > > + > > + /* > > + * Save some code text when online_section() + > > + * pfn_section_valid() are sufficient. > > + */ > > + if (IS_ENABLED(CONFIG_HAVE_ARCH_PFN_VALID)) > > + if (!pfn_valid(pfn)) > > + return NULL; > > Nit: > > if (IS_ENABLED(CONFIG_HAVE_ARCH_PFN_VALID) && > !pfn_valid(pfn)) > Ok... I'll do a final resend "To: akpm" after the kbuild robot finishes chewing on this series.