Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp970308ybl; Tue, 28 Jan 2020 15:59:37 -0800 (PST) X-Google-Smtp-Source: APXvYqxOYAX8w4I6qqtGbCwj0KpEl6+ls6WgArIuPixOPrPtIiuPwmfVA9RqwGdFwxrLk1XDtAOZ X-Received: by 2002:a05:6830:139a:: with SMTP id d26mr19065774otq.75.1580255977138; Tue, 28 Jan 2020 15:59:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580255977; cv=none; d=google.com; s=arc-20160816; b=ekS6pAnZfpXr7M2fbuNXS1vEOtq3It2uvQEt2COkUtLJLGCknSXfV4zLwBYcFTfPkX gt+V2QOiA6FCzhcclUKz5Y49U4pKJXFo81jt9WvO5pU2zcmHAzyTYsAv9j4ZxsbOJEJR J4pG40twaNCSt20+n4ur6MAFbMn+97L4fxFYBvKeCGq/HtO1uENjPe8b5P3VP4RnMyCF GNLFFquSqVn4AxbeswIMWqLbdQ7Mj+lIiCDVFcKZPoE/E/cGsJy4itJMcafsYq742U7Z VdBY6cLydoeer7MzYN5g2EUX8i/gy39xMx+4aCa2de39iXWhnIa1xs9pDfz2u4JrIPFw 5J1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from; bh=CJAFsObzdncqMkcc8RdAeZR+hh0RZis07CX3QD1TqCE=; b=Wow88T5OtUHCp5VVHLDALQOK/GpRHsHyPSAy/nbtYZwjkwW6rfrAG950WxigJ62aBN 3VeXrQnxFu3zis2YLORziJY40HswfdbqrgREeDe+7UIMQXnDU5aSIt72VcPTVWysoQLN pDQK02jO7Q+xMHqRGojYdSwH/hPLHZVm5WU3JwxjAh5E8X7tAH4vMdrseLom0XgdmSWW yqMSailV0BF12leTYxhtjFIglsOWhgcfb8BX7XBUWL5MdevqEyorVr969prsDFVjdf2C FLfjpUnchDyrp1sySOJNPoteTEfHAop0lro3WuVDkw0WbgDnmd1MoBWPcf2hzNCTE4bs ZacA== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l84si203504oig.5.2020.01.28.15.59.24; Tue, 28 Jan 2020 15:59:37 -0800 (PST) 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726496AbgA1X5H (ORCPT + 99 others); Tue, 28 Jan 2020 18:57:07 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:34950 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726293AbgA1X5G (ORCPT ); Tue, 28 Jan 2020 18:57:06 -0500 Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 00SNd1uv039837; Tue, 28 Jan 2020 18:56:59 -0500 Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 2xrk2fxqk4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 28 Jan 2020 18:56:58 -0500 Received: from m0098394.ppops.net (m0098394.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 00SNt1EF134993; Tue, 28 Jan 2020 18:56:58 -0500 Received: from ppma02wdc.us.ibm.com (aa.5b.37a9.ip4.static.sl-reverse.com [169.55.91.170]) by mx0a-001b2d01.pphosted.com with ESMTP id 2xrk2fxqjq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 28 Jan 2020 18:56:58 -0500 Received: from pps.filterd (ppma02wdc.us.ibm.com [127.0.0.1]) by ppma02wdc.us.ibm.com (8.16.0.27/8.16.0.27) with SMTP id 00SNtIva020067; Tue, 28 Jan 2020 23:56:57 GMT Received: from b03cxnp08027.gho.boulder.ibm.com (b03cxnp08027.gho.boulder.ibm.com [9.17.130.19]) by ppma02wdc.us.ibm.com with ESMTP id 2xrda6nnwv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 28 Jan 2020 23:56:57 +0000 Received: from b03ledav006.gho.boulder.ibm.com (b03ledav006.gho.boulder.ibm.com [9.17.130.237]) by b03cxnp08027.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 00SNuuco58982910 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 28 Jan 2020 23:56:56 GMT Received: from b03ledav006.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 69928C6059; Tue, 28 Jan 2020 23:56:56 +0000 (GMT) Received: from b03ledav006.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4A611C6055; Tue, 28 Jan 2020 23:56:56 +0000 (GMT) Received: from localhost (unknown [9.41.179.160]) by b03ledav006.gho.boulder.ibm.com (Postfix) with ESMTP; Tue, 28 Jan 2020 23:56:56 +0000 (GMT) From: Nathan Lynch To: Scott Cheloha Cc: Nathan Fontenont , Rick Lindsley , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, Michael Ellerman Subject: Re: [PATCH] powerpc/drmem: cache LMBs in xarray to accelerate lookup In-Reply-To: <20200128221113.17158-1-cheloha@linux.ibm.com> References: <20200128221113.17158-1-cheloha@linux.ibm.com> Date: Tue, 28 Jan 2020 17:56:55 -0600 Message-ID: <87pnf3i188.fsf@linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138,18.0.572 definitions=2020-01-28_09:2020-01-28,2020-01-28 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 malwarescore=0 suspectscore=1 mlxscore=0 adultscore=0 bulkscore=0 mlxlogscore=758 priorityscore=1501 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-1911200001 definitions=main-2001280175 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Scott Cheloha writes: > LMB lookup is currently an O(n) linear search. This scales poorly when > there are many LMBs. > > If we cache each LMB by both its base address and its DRC index > in an xarray we can cut lookups to O(log n), greatly accelerating > drmem initialization and memory hotplug. > > This patch introduces two xarrays of of LMBs and fills them during > drmem initialization. The patch also adds two interfaces for LMB > lookup. Good but can you replace the array of LMBs altogether (drmem_info->lmbs)? xarray allows iteration over the members if needed.