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=-0.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no 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 DD3B7C433E0 for ; Wed, 8 Jul 2020 06:22:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C673B2078A for ; Wed, 8 Jul 2020 06:22:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728688AbgGHGWf (ORCPT ); Wed, 8 Jul 2020 02:22:35 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:22828 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725298AbgGHGWf (ORCPT ); Wed, 8 Jul 2020 02:22:35 -0400 Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 06862d6T045107; Wed, 8 Jul 2020 02:22:26 -0400 Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3257t4shd3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 08 Jul 2020 02:22:26 -0400 Received: from m0098399.ppops.net (m0098399.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 06865GPK053870; Wed, 8 Jul 2020 02:22:26 -0400 Received: from ppma04ams.nl.ibm.com (63.31.33a9.ip4.static.sl-reverse.com [169.51.49.99]) by mx0a-001b2d01.pphosted.com with ESMTP id 3257t4shc7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 08 Jul 2020 02:22:26 -0400 Received: from pps.filterd (ppma04ams.nl.ibm.com [127.0.0.1]) by ppma04ams.nl.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 0686GWKF027195; Wed, 8 Jul 2020 06:22:23 GMT Received: from b06avi18626390.portsmouth.uk.ibm.com (b06avi18626390.portsmouth.uk.ibm.com [9.149.26.192]) by ppma04ams.nl.ibm.com with ESMTP id 322hd7v6yh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 08 Jul 2020 06:22:23 +0000 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06avi18626390.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 0686KxYT59113834 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 8 Jul 2020 06:21:00 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3158911C05B; Wed, 8 Jul 2020 06:22:21 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 93C8E11C054; Wed, 8 Jul 2020 06:22:19 +0000 (GMT) Received: from linux.ibm.com (unknown [9.148.202.29]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Wed, 8 Jul 2020 06:22:19 +0000 (GMT) Date: Wed, 8 Jul 2020 09:22:17 +0300 From: Mike Rapoport To: Dan Williams Cc: Justin He , Michal Hocko , David Hildenbrand , Catalin Marinas , Will Deacon , Vishal Verma , Dave Jiang , Andrew Morton , Baoquan He , Chuhong Yuan , "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" , "linux-mm@kvack.org" , "linux-nvdimm@lists.01.org" , Kaly Xin Subject: Re: [PATCH v2 1/3] arm64/numa: export memory_add_physaddr_to_nid as EXPORT_SYMBOL_GPL Message-ID: <20200708062217.GE386073@linux.ibm.com> References: <20200707055917.143653-1-justin.he@arm.com> <20200707055917.143653-2-justin.he@arm.com> <20200707115454.GN5913@dhcp22.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235,18.0.687 definitions=2020-07-08_01:2020-07-08,2020-07-08 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 impostorscore=0 spamscore=0 clxscore=1015 malwarescore=0 mlxscore=0 mlxlogscore=999 priorityscore=1501 cotscore=-2147483648 phishscore=0 bulkscore=0 adultscore=0 suspectscore=1 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2007080042 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jul 07, 2020 at 09:27:43PM -0700, Dan Williams wrote: > On Tue, Jul 7, 2020 at 9:08 PM Justin He wrote: > [..] > > > Especially for architectures that use memblock info for numa info > > > (which seems to be everyone except x86) why not implement a generic > > > memory_add_physaddr_to_nid() that does: > > > > > > int memory_add_physaddr_to_nid(u64 addr) > > > { > > > unsigned long start_pfn, end_pfn, pfn = PHYS_PFN(addr); > > > int nid; > > > > > > for_each_online_node(nid) { > > > get_pfn_range_for_nid(nid, &start_pfn, &end_pfn); > > > if (pfn >= start_pfn && pfn <= end_pfn) > > > return nid; > > > } > > > return NUMA_NO_NODE; > > > } > > > > Thanks for your suggestion, > > Could I wrap the codes and let memory_add_physaddr_to_nid simply invoke > > phys_to_target_node()? > > I think it needs to be the reverse. phys_to_target_node() should call > memory_add_physaddr_to_nid() by default, but fall back to searching > reserved memory address ranges in memblock. See phys_to_target_node() > in arch/x86/mm/numa.c. That one uses numa_meminfo instead of memblock, > but the principle is the same i.e. that a target node may not be > represented in memblock.memory, but memblock.reserved. I'm working on > a patch to provide a function similar to get_pfn_range_for_nid() that > operates on reserved memory. Do we really need yet another memblock iterator? I think only x86 has memory that is not in memblock.memory but only in memblock.reserved. -- Sincerely yours, Mike.