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=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,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 B18C5C433DF for ; Wed, 8 Jul 2020 06:25:17 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7F0E820720 for ; Wed, 8 Jul 2020 06:25:17 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Uqd/3+1w" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7F0E820720 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.ibm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=4/azsVGlYvlDjEUkN47hpJ6UPqeSYNUfVsD5QueBTJw=; b=Uqd/3+1wQimHcCSfRgkRSEHx9 VlxV1stKaSRFlC64YKJmmaeTW/AqDD8F+xynbus5BpeXc2OFDl+pACR5+HzNGy5K/2nbFgAPMsQQ+ 7ZK7vy5u5eR+4M3zV3csfozGL5JrrFsFY5a4DOEvQYil5FCCcTIEjuYE64uw4WJib+pgjKD4SVcqH lUGjwJnDeLME72cdRfzYhZMK7xKeQu2fMZ7KzO41Cn4LPNcfc6TKzse/XeJHaVaOZl9jHk1sOBdHk pOzj6c8cer4eijtec0Jx23oSZSBVhHx0pDnkKFm8QKv2KXMpJU209mj7XGMLTSawp+hAZZ2P/BtTP /i/PBIyXg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jt3TY-0002rc-B9; Wed, 08 Jul 2020 06:22:36 +0000 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jt3TV-0002qp-N2 for linux-arm-kernel@lists.infradead.org; Wed, 08 Jul 2020 06:22:34 +0000 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 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-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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200708_022233_912102_CC1AD59A X-CRM114-Status: GOOD ( 20.77 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kaly Xin , Justin He , Baoquan He , David Hildenbrand , Catalin Marinas , "linux-nvdimm@lists.01.org" , Chuhong Yuan , "linux-kernel@vger.kernel.org" , Michal Hocko , "linux-mm@kvack.org" , Vishal Verma , Dave Jiang , Andrew Morton , Will Deacon , "linux-arm-kernel@lists.infradead.org" Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel