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=-18.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 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 5D9AAC4708F for ; Tue, 1 Jun 2021 08:23:01 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 08B42613AD for ; Tue, 1 Jun 2021 08:23:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 08B42613AD 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 9A9366B0082; Tue, 1 Jun 2021 04:23:00 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 97ECD6B0083; Tue, 1 Jun 2021 04:23:00 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7F9D66B0085; Tue, 1 Jun 2021 04:23:00 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0036.hostedemail.com [216.40.44.36]) by kanga.kvack.org (Postfix) with ESMTP id 4B0DD6B0082 for ; Tue, 1 Jun 2021 04:23:00 -0400 (EDT) Received: from smtpin31.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id D88C8181AC9BF for ; Tue, 1 Jun 2021 08:22:59 +0000 (UTC) X-FDA: 78204464478.31.9129215 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf27.hostedemail.com (Postfix) with ESMTP id 64C0D8019361 for ; Tue, 1 Jun 2021 08:22:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1622535779; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qko+6OLUI0ASBUaG2AM+FeVy91xdoIP6u9Dh5KlRzDM=; b=Rbaf8kXZvNuBkWoObgjv2T9eVaq0gP0kcj/xtEBcWwyNNn1P5Ez0TmRn2/j07NPMfnvJVj HfpViWtYK/2rtIWj+PqK0dFYZnl2hl8Q3w4826map3sraxkp62UE+ih0FLIqmCH+U5pv+b USyOP/9upVjhL/46qrtSDgJcBqSJSeI= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-350-WZPV3yEAPUCBqYkNslnOdA-1; Tue, 01 Jun 2021 04:22:57 -0400 X-MC-Unique: WZPV3yEAPUCBqYkNslnOdA-1 Received: by mail-wm1-f71.google.com with SMTP id y129-20020a1c32870000b029016920cc7087so2451855wmy.4 for ; Tue, 01 Jun 2021 01:22:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:organization :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=qko+6OLUI0ASBUaG2AM+FeVy91xdoIP6u9Dh5KlRzDM=; b=n1yK0+kd3u88S6hDzYIX53qi8pV86c+flH2qQDEYAxee9RfJmhoD3zhgFX6WgE7Uay 1QbGWWFL9B12XSQROl1C+jmkNPVGbhxeYfUdjR3AxG8Z/QGJNqL11n2DXML8YPoBdvbw 6NziGkJnklBAHcBYCECC8XzpmURjvjQTVA4qM3mEgTU+gzSPQTBgKRZKIsM8A5mxejt1 rvxFobKrMC2dRMBhi/xoV0YN9OxX//FxYh5nX1n72I7Eh1atGb8qq6cYa4JefT9k4vP2 RuiBkX1QIYhHPj2lJ37TduLBh/DCQi+3qN+tGggCuqjNNtyg7n+o3KDC7Pe/Kl15zJp0 oeNw== X-Gm-Message-State: AOAM5312Or/pyotDKYLGk6j9ZN0Zmp8dClFomAinaVIXTEzBEwvC8SRD kDfiKksDDR5SPCWhalv43m6+Zo7dhIm2qPbO4nCAQ+HFanI2qsrZm0pKyjoFWUQYWvJAdL/kx5r 7wz7Y4QNrx24= X-Received: by 2002:adf:e3c8:: with SMTP id k8mr26044480wrm.212.1622535776735; Tue, 01 Jun 2021 01:22:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw12KgcgZ8BBy3UXy4SYPbp+iNY/jg5z1LMDTYyJdmcpHn2xiuwKa6oYIoF0d0arEpT0pG4GA== X-Received: by 2002:adf:e3c8:: with SMTP id k8mr26044457wrm.212.1622535776531; Tue, 01 Jun 2021 01:22:56 -0700 (PDT) Received: from [192.168.3.132] (p5b0c69ce.dip0.t-ipconnect.de. [91.12.105.206]) by smtp.gmail.com with ESMTPSA id v18sm2485369wrb.10.2021.06.01.01.22.55 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 01 Jun 2021 01:22:56 -0700 (PDT) Subject: Re: [PATCH V2 4/6] mm: rename the global section array to mem_sections To: Dong Aisheng , linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org, dongas86@gmail.com, Andrew Morton , Dave Young , Baoquan He , Vivek Goyal , kexec@lists.infradead.org References: <20210531091908.1738465-1-aisheng.dong@nxp.com> <20210531091908.1738465-5-aisheng.dong@nxp.com> From: David Hildenbrand Organization: Red Hat Message-ID: <42617372-c846-85fe-4739-abbe55eca8f6@redhat.com> Date: Tue, 1 Jun 2021 10:22:55 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: <20210531091908.1738465-5-aisheng.dong@nxp.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=Rbaf8kXZ; spf=none (imf27.hostedemail.com: domain of david@redhat.com has no SPF policy when checking 170.10.133.124) smtp.mailfrom=david@redhat.com; dmarc=pass (policy=none) header.from=redhat.com X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 64C0D8019361 X-Stat-Signature: jtagy1izi7new43kxfubh1po33opd1tb X-HE-Tag: 1622535767-407935 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 31.05.21 11:19, Dong Aisheng wrote: > In order to distinguish the struct mem_section for a better code > readability and align with kernel doc [1] name below, change the > global mem section name to 'mem_sections' from 'mem_section'. > > [1] Documentation/vm/memory-model.rst > "The `mem_section` objects are arranged in a two-dimensional array > called `mem_sections`." > > Cc: Andrew Morton > Cc: Dave Young > Cc: Baoquan He > Cc: Vivek Goyal > Cc: kexec@lists.infradead.org > Signed-off-by: Dong Aisheng > --- > v1->v2: > * no changes > --- > include/linux/mmzone.h | 10 +++++----- > kernel/crash_core.c | 4 ++-- > mm/sparse.c | 16 ++++++++-------- > 3 files changed, 15 insertions(+), 15 deletions(-) > > diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h > index a6bfde85ddb0..0ed61f32d898 100644 > --- a/include/linux/mmzone.h > +++ b/include/linux/mmzone.h > @@ -1302,9 +1302,9 @@ struct mem_section { > #define SECTION_ROOT_MASK (SECTIONS_PER_ROOT - 1) > > #ifdef CONFIG_SPARSEMEM_EXTREME > -extern struct mem_section **mem_section; > +extern struct mem_section **mem_sections; > #else > -extern struct mem_section mem_section[NR_SECTION_ROOTS][SECTIONS_PER_ROOT]; > +extern struct mem_section mem_sections[NR_SECTION_ROOTS][SECTIONS_PER_ROOT]; > #endif > > static inline unsigned long *section_to_usemap(struct mem_section *ms) > @@ -1315,12 +1315,12 @@ static inline unsigned long *section_to_usemap(struct mem_section *ms) > static inline struct mem_section *__nr_to_section(unsigned long nr) > { > #ifdef CONFIG_SPARSEMEM_EXTREME > - if (!mem_section) > + if (!mem_sections) > return NULL; > #endif > - if (!mem_section[SECTION_NR_TO_ROOT(nr)]) > + if (!mem_sections[SECTION_NR_TO_ROOT(nr)]) > return NULL; > - return &mem_section[SECTION_NR_TO_ROOT(nr)][nr & SECTION_ROOT_MASK]; > + return &mem_sections[SECTION_NR_TO_ROOT(nr)][nr & SECTION_ROOT_MASK]; > } > extern unsigned long __section_nr(struct mem_section *ms); > extern size_t mem_section_usage_size(void); > diff --git a/kernel/crash_core.c b/kernel/crash_core.c > index 29cc15398ee4..fb1180d81b5a 100644 > --- a/kernel/crash_core.c > +++ b/kernel/crash_core.c > @@ -414,8 +414,8 @@ static int __init crash_save_vmcoreinfo_init(void) > VMCOREINFO_SYMBOL(contig_page_data); > #endif > #ifdef CONFIG_SPARSEMEM > - VMCOREINFO_SYMBOL_ARRAY(mem_section); > - VMCOREINFO_LENGTH(mem_section, NR_SECTION_ROOTS); > + VMCOREINFO_SYMBOL_ARRAY(mem_sections); > + VMCOREINFO_LENGTH(mem_sections, NR_SECTION_ROOTS); > VMCOREINFO_STRUCT_SIZE(mem_section); > VMCOREINFO_OFFSET(mem_section, section_mem_map); > VMCOREINFO_NUMBER(MAX_PHYSMEM_BITS); > diff --git a/mm/sparse.c b/mm/sparse.c > index d02ee6bb7cbc..6412010478f7 100644 > --- a/mm/sparse.c > +++ b/mm/sparse.c > @@ -24,12 +24,12 @@ > * 1) mem_section - memory sections, mem_map's for valid memory > */ > #ifdef CONFIG_SPARSEMEM_EXTREME > -struct mem_section **mem_section; > +struct mem_section **mem_sections; > #else > -struct mem_section mem_section[NR_SECTION_ROOTS][SECTIONS_PER_ROOT] > +struct mem_section mem_sections[NR_SECTION_ROOTS][SECTIONS_PER_ROOT] > ____cacheline_internodealigned_in_smp; > #endif > -EXPORT_SYMBOL(mem_section); > +EXPORT_SYMBOL(mem_sections); > > #ifdef NODE_NOT_IN_PAGE_FLAGS > /* > @@ -66,8 +66,8 @@ static void __init sparse_alloc_section_roots(void) > > size = sizeof(struct mem_section *) * NR_SECTION_ROOTS; > align = 1 << (INTERNODE_CACHE_SHIFT); > - mem_section = memblock_alloc(size, align); > - if (!mem_section) > + mem_sections = memblock_alloc(size, align); > + if (!mem_sections) > panic("%s: Failed to allocate %lu bytes align=0x%lx\n", > __func__, size, align); > } > @@ -103,14 +103,14 @@ static int __meminit sparse_index_init(unsigned long section_nr, int nid) > * > * The mem_hotplug_lock resolves the apparent race below. > */ > - if (mem_section[root]) > + if (mem_sections[root]) > return 0; > > section = sparse_index_alloc(nid); > if (!section) > return -ENOMEM; > > - mem_section[root] = section; > + mem_sections[root] = section; > > return 0; > } > @@ -145,7 +145,7 @@ unsigned long __section_nr(struct mem_section *ms) > #else > unsigned long __section_nr(struct mem_section *ms) > { > - return (unsigned long)(ms - mem_section[0]); > + return (unsigned long)(ms - mem_sections[0]); > } > #endif > > I repeat: unnecessary code churn IMHO. -- Thanks, David / dhildenb