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.4 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable 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 EE4C1C10F26 for ; Sat, 7 Mar 2020 11:56:09 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id B27742070A for ; Sat, 7 Mar 2020 11:56:09 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="BHwd57fc" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B27742070A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 413F56B0003; Sat, 7 Mar 2020 06:56:09 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 39C556B0006; Sat, 7 Mar 2020 06:56:09 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 23CCD6B0007; Sat, 7 Mar 2020 06:56:09 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 0949C6B0003 for ; Sat, 7 Mar 2020 06:56:09 -0500 (EST) Received: from smtpin26.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id B7B0B482A for ; Sat, 7 Mar 2020 11:56:08 +0000 (UTC) X-FDA: 76568412816.26.money36_1881945942d08 X-HE-Tag: money36_1881945942d08 X-Filterd-Recvd-Size: 5229 Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) by imf25.hostedemail.com (Postfix) with ESMTP for ; Sat, 7 Mar 2020 11:56:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1583582167; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=jVGh5l7IYfQ0JRs6ZhFDe9dOS0KlBegkv9u7kXJdDx0=; b=BHwd57fcH9T3LcI3xal/r+mCldEKWWqEjcNXVm1jLkFvmM1Aa2ImnpTMnaSfEyLX1YW/t6 h9a6QLfsMUGpaStXy67R6McT5jQ8woXyyLkUmpdjjYeqcZJbKziJ0OAYRn84Zwko+fDVFK Tz/PbPM0+d2g0we7KZAl5VEgo1CAXMQ= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-44-w7WOqL_qPleAx0MieHxsHg-1; Sat, 07 Mar 2020 06:56:03 -0500 X-MC-Unique: w7WOqL_qPleAx0MieHxsHg-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 77FE7801E6C; Sat, 7 Mar 2020 11:56:02 +0000 (UTC) Received: from localhost (ovpn-12-29.pek2.redhat.com [10.72.12.29]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CFD5A9078A; Sat, 7 Mar 2020 11:55:58 +0000 (UTC) Date: Sat, 7 Mar 2020 19:55:56 +0800 From: Baoquan He To: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, akpm@linux-foundation.org, mhocko@suse.com, 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: <20200307115556.GB27711@MiWiFi-R3L-srv> 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> User-Agent: Mutt/1.10.1 (2018-07-13) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 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 03/07/20 at 04:42pm, Baoquan He wrote: Sorry, the subject should be: mm/sparse.c: add note about only VMEMMAP supporting sub-section hotplug > 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 > --- > 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 >