Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp291725ybt; Tue, 7 Jul 2020 23:31:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwXWUHbySZNhKvzrRwLrchL8I+MS8Xa9vFOi9h4L4tHXoZKDJe5yJMTyk5GnpLMmMYC1Tnx X-Received: by 2002:a17:906:fa13:: with SMTP id lo19mr50022247ejb.213.1594189879979; Tue, 07 Jul 2020 23:31:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594189879; cv=none; d=google.com; s=arc-20160816; b=DMi/qnwumh8pTLuNm3iML4Iy8PtaDi3bxcjoEutfl10g3b4zBENt4u/5zyDwWbkiT1 upqMGogzjIM44Q8G0k/vOzkXeCWxaP6WTI2EvfRyGfXi7HpWvCI3NrZB7uVihowJztee kBsJ04DEn0Ah8VJJJV/OzrjV5//rriOWAc1PNg1M5mtx/0CpiX8VXJKMbUoTkr7VYOCH CzLc6jJX6hr0ifdzhyHXzM1JTkSyHF4V17L10PMLY4uyjRcZ+LyyWCiW7HV7JWitASWV NSUiBBF9xhykqtgo/GvNN+X/fowCCrV+W0VX2G7XNHmXURRlWk9ImOJtpIGqwK3/Kkgf KnwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=SbQ5ogdMJyNVy5tfgYhBormwtDeZI5qTahHvRC06zWI=; b=wyDcuF7hI6COon9CMtlDeYW+SK3QS2jz7YkuPUIu6r2nE8VgI33fO4hOGt31aXlA23 yiOFBWzUvXiKqXp+chdYmgESe1fBk9G6GYqKZ0pypWEjM9WMPpEIkXEXLkhNTgwLsCFm yqjEXw+2Tx81xEnSqs3Daf53fM4cbfwInWDrDy47bdt1SGMDwfY9M03ou5zCtGZQFEZM wIS+PH3xhugSeDfRpAurqNpzubL/40Y5m6UyhUWaFUGJ8PdjcH8DZjgsau3Qc03pSFxo RqzFV9s+py26LyCJQPxj1JP7VyHkUGADMPLIpQbwuUrUdAJPBhEvGe7LfpBBxfBuO+dP yW5g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o17si3120195ejg.160.2020.07.07.23.30.56; Tue, 07 Jul 2020 23:31:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728542AbgGHGWf (ORCPT + 99 others); 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.