Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp51469ybl; Fri, 9 Aug 2019 02:19:01 -0700 (PDT) X-Google-Smtp-Source: APXvYqzh7xFLE7J/4xduVi6wYsAHPv6cjeJIbmPyr4qsRTJ65Btibjk5xb/RpQpCOGdfxF628MJA X-Received: by 2002:a17:90a:23c5:: with SMTP id g63mr2175138pje.124.1565342341363; Fri, 09 Aug 2019 02:19:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565342341; cv=none; d=google.com; s=arc-20160816; b=oZh5Xw8v34lnvVdPsTlCZof1SKLrhDWAMgUJMJVo+0px59WqIGtlBgOYyJeOOZdjrU Kac6vrLG8iCoATuIeGzS20eFC1E2uBE+gmGSIMkoMNb9JRDP9sTTyX9Rvhksr1xMsC34 Tzq9HHPVVSerRscxrK7csDD8MNN4tet/b+nDK3raiaGlpdnNopPBNJS/ssFuVB5LeMkt cHN6gWJe47dYbYeCQFFOY1jsWQEjWSDQf+PhEWTN3VPhNRBTaWKSCEKw/+bAGQc449Ft Z+XMN8LaVOkpKj7LsMeyPD9g6oYMsNYQ/178oZnTDRjmQR78abR6T9cvSNUACYpIRslP 9NxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=G54Zwt+vB8h0+nqggCSrXu0/L6XlohtfmHz2tCBORb8=; b=o6i2IaA89nTH21fCKDHNo+oMPDUKbKKNT21NNwKFS4MtkjQRfW6q0pLiYzZcIGYOqB tUIG/nxCOwjYuXIeOmEp7+Y0wybBUg/qSHD5I4eSHHBy8JsE+JHEvvmXiY+EGZVJdkzY RBHLI31yaeTBy4cxiqo63WnDUSzLXI09ObAnzIYzeyRZBnOv5l5pjqFz5NeXBpHxM+Za MaQ3WHvxV+s2bKI1AWzn9G+8jvHNMgAowbNoDxR3I8B9V27PmRJHdjLnif1fVGR9A33E vJ9YOqBLSDPtnG3FWv06mSr7lLlCMehXIjzbPmXwOlPCJ9HbfobhIh+/U47izlvOkIGY 0buQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e20si24249940pgn.181.2019.08.09.02.18.46; Fri, 09 Aug 2019 02:19:01 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2406064AbfHIJKI (ORCPT + 99 others); Fri, 9 Aug 2019 05:10:08 -0400 Received: from foss.arm.com ([217.140.110.172]:43896 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726054AbfHIJKI (ORCPT ); Fri, 9 Aug 2019 05:10:08 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 8043515A2; Fri, 9 Aug 2019 02:10:07 -0700 (PDT) Received: from [10.163.1.243] (unknown [10.163.1.243]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id EE6A33F575; Fri, 9 Aug 2019 02:10:03 -0700 (PDT) Subject: Re: [PATCH] mm/sparse: use __nr_to_section(section_nr) to get mem_section To: Wei Yang , akpm@linux-foundation.org, osalvador@suse.de, pasha.tatashin@oracle.com, mhocko@suse.com Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org References: <20190809010242.29797-1-richardw.yang@linux.intel.com> From: Anshuman Khandual Message-ID: Date: Fri, 9 Aug 2019 14:39:59 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20190809010242.29797-1-richardw.yang@linux.intel.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 08/09/2019 06:32 AM, Wei Yang wrote: > __pfn_to_section is defined as __nr_to_section(pfn_to_section_nr(pfn)). Right. > > Since we already get section_nr, it is not necessary to get mem_section > from start_pfn. By doing so, we reduce one redundant operation. > > Signed-off-by: Wei Yang Looks right. With this applied, memory hot add still works on arm64. Reviewed-by: Anshuman Khandual > --- > mm/sparse.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/mm/sparse.c b/mm/sparse.c > index 72f010d9bff5..95158a148cd1 100644 > --- a/mm/sparse.c > +++ b/mm/sparse.c > @@ -867,7 +867,7 @@ int __meminit sparse_add_section(int nid, unsigned long start_pfn, > */ > page_init_poison(pfn_to_page(start_pfn), sizeof(struct page) * nr_pages); > > - ms = __pfn_to_section(start_pfn); > + ms = __nr_to_section(section_nr); > set_section_nid(section_nr, nid); > section_mark_present(ms); > >