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=-7.0 required=3.0 tests=INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,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 6211BC10F27 for ; Tue, 10 Mar 2020 14:46:21 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 2E9912146E for ; Tue, 10 Mar 2020 14:46:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2E9912146E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id B5C246B0005; Tue, 10 Mar 2020 10:46:20 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B33446B0006; Tue, 10 Mar 2020 10:46:20 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A22346B0007; Tue, 10 Mar 2020 10:46:20 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0018.hostedemail.com [216.40.44.18]) by kanga.kvack.org (Postfix) with ESMTP id 8A4D96B0005 for ; Tue, 10 Mar 2020 10:46:20 -0400 (EDT) Received: from smtpin20.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 5FB28180AD81A for ; Tue, 10 Mar 2020 14:46:20 +0000 (UTC) X-FDA: 76579728120.20.art79_546c3d1dd4809 X-HE-Tag: art79_546c3d1dd4809 X-Filterd-Recvd-Size: 5544 Received: from mail-wr1-f66.google.com (mail-wr1-f66.google.com [209.85.221.66]) by imf44.hostedemail.com (Postfix) with ESMTP for ; Tue, 10 Mar 2020 14:46:20 +0000 (UTC) Received: by mail-wr1-f66.google.com with SMTP id r7so16261881wro.2 for ; Tue, 10 Mar 2020 07:46:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=crbMDI2Wimbm4HzDN7I4IadEFygYJVO7wqLa6x2GCB0=; b=IlW2G04Zuu+M0jqsEWT9H1p4l+3RWl3oKfSpyvjA8XJ6mQbe94ylXjBF+lvI6e71Qi TfhgfxfEwMMJ5oaJvGNQK0casX2YlAOmxjC7DA/SUqxnND2DBuJAPsvq6OFPdakEK8FI z6G4Bew4FDeMEBFcIxzYXOzJ647kX46kFYDVK5yObeBcsaDK1zyUEy/rev39HvNBCPTU InIV+oFgG6aYlyLtgt4LkhB3PAzA9Z4AK0+K5qNMknCUp0DCjMgJ3fKniXNA44McMhrf f8Ptng7T9vFpfU4kNjSxR0JtkpGEJ6PZddMijr+MMtvOzeDDVGIWl5lN78Zm9d3C1IFo vHuQ== X-Gm-Message-State: ANhLgQ2SH3r34XVsRpeiU4KO0rN/nCFw0wCtcviqq0bnvNRjqVeESmPo CvfJEXqKgBZh2bJfCH+NKPE= X-Google-Smtp-Source: ADFU+vs+x5SuPXyNi5EA7awyb+YpsPeAacDIV/ITuPW+C/+phyX1/4KoqZW9FDZmPvqisWLvb4P1MA== X-Received: by 2002:adf:f00d:: with SMTP id j13mr29112891wro.207.1583851578791; Tue, 10 Mar 2020 07:46:18 -0700 (PDT) Received: from localhost (prg-ext-pat.suse.com. [213.151.95.130]) by smtp.gmail.com with ESMTPSA id y200sm1844481wmc.20.2020.03.10.07.46.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Mar 2020 07:46:18 -0700 (PDT) Date: Tue, 10 Mar 2020 15:46:16 +0100 From: Michal Hocko To: Baoquan He Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, akpm@linux-foundation.org, david@redhat.com, richardw.yang@linux.intel.com, dan.j.williams@intel.com, osalvador@suse.de, rppt@linux.ibm.com Subject: Re: [PATCH v3 5/7] mm/sparse.c: add note about only VMEMMAP supporting sub-section support Message-ID: <20200310144616.GM8447@dhcp22.suse.cz> References: <20200307084229.28251-1-bhe@redhat.com> <20200307084229.28251-6-bhe@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200307084229.28251-6-bhe@redhat.com> 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 Sat 07-03-20 16:42:27, Baoquan He wrote: > And tell check_pfn_span() gating the porper alignment and size of > hot added memory region. > > And also move the code comments from inside section_deactivate() > to being above it. The code comments are reasonable for the whole > function, and the moving makes code cleaner. > > Signed-off-by: Baoquan He Acked-by: Michal Hocko I have glanced through other patches and they seem sane but I do not have time to go deeper to give an ack. I like this one though because it really makes the intention clearer. > --- > mm/sparse.c | 37 ++++++++++++++++++++----------------- > 1 file changed, 20 insertions(+), 17 deletions(-) > > diff --git a/mm/sparse.c b/mm/sparse.c > index 2142045ab5c5..0fbd79c4ad81 100644 > --- a/mm/sparse.c > +++ b/mm/sparse.c > @@ -772,6 +772,22 @@ static bool is_subsection_map_empty(struct mem_section *ms) > } > #endif > > +/* > + * To deactivate a memory region, there are 3 cases to handle across > + * two configurations (SPARSEMEM_VMEMMAP={y,n}): > + * > + * 1. deactivation of a partial hot-added section (only possible in > + * the SPARSEMEM_VMEMMAP=y case). > + * a) section was present at memory init. > + * b) section was hot-added post memory init. > + * 2. deactivation of a complete hot-added section. > + * 3. deactivation of a complete section from memory init. > + * > + * For 1, when subsection_map does not empty we will not be freeing the > + * usage map, but still need to free the vmemmap range. > + * > + * For 2 and 3, the SPARSEMEM_VMEMMAP={y,n} cases are unified > + */ > static void section_deactivate(unsigned long pfn, unsigned long nr_pages, > struct vmem_altmap *altmap) > { > @@ -784,23 +800,6 @@ static void section_deactivate(unsigned long pfn, unsigned long nr_pages, > return; > > empty = is_subsection_map_empty(ms); > - /* > - * There are 3 cases to handle across two configurations > - * (SPARSEMEM_VMEMMAP={y,n}): > - * > - * 1/ deactivation of a partial hot-added section (only possible > - * in the SPARSEMEM_VMEMMAP=y case). > - * a/ section was present at memory init > - * b/ section was hot-added post memory init > - * 2/ deactivation of a complete hot-added section > - * 3/ deactivation of a complete section from memory init > - * > - * For 1/, when subsection_map does not empty we will not be > - * freeing the usage map, but still need to free the vmemmap > - * range. > - * > - * For 2/ and 3/ the SPARSEMEM_VMEMMAP={y,n} cases are unified > - */ > if (empty) { > unsigned long section_nr = pfn_to_section_nr(pfn); > > @@ -907,6 +906,10 @@ static struct page * __meminit section_activate(int nid, unsigned long pfn, > * > * This is only intended for hotplug. > * > + * Note that only VMEMMAP supports sub-section aligned hotplug, > + * the proper alignment and size are gated by check_pfn_span(). > + * > + * > * Return: > * * 0 - On success. > * * -EEXIST - Section has been present. > -- > 2.17.2 > -- Michal Hocko SUSE Labs