Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp7898518ybl; Thu, 16 Jan 2020 07:24:50 -0800 (PST) X-Google-Smtp-Source: APXvYqykQkr58v4EdJ8A6mcHd3d8xlHEbQgsSPB6xlUs7tudu5oyCLBF6BVQYOPr8TkCqYH6uJgk X-Received: by 2002:a05:6830:1503:: with SMTP id k3mr2300811otp.213.1579188289984; Thu, 16 Jan 2020 07:24:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579188289; cv=none; d=google.com; s=arc-20160816; b=OyHXDtGKKtjsywKckuqwiY0VxP/nrzOSStIIW0+FoCYfG4404hkm7of3AymxOdIpcs UI7dwUNJv8c6TTxhfrcCyyQY27g2boRXz47ikpCrXenOVutB6kKPLFwqLtFgNIwC/dIW 9S7ZuozZLTrN2ecyvB8XLJuZJiIGrhzMb2NUvgnZgQLVc/lRlThWSaob1+/wfo66OavG WS1Xsa70eDk7q6NQHZHr30KRL3wGRvm1Na+P6bkwncbiNH9MQKN24idRaNDFu8I2coO9 aeYvORxW9V2p+TPphFmNJD9u01m7uUoaPfMx4i/ZoxzeUJU7ikpzupwiRuCegvA44K16 q2LQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=FTzYumS8YOtnp3SJI0/nekGMa3Yhr59tUFnF0F2ptLU=; b=D3sWc6FMlUdUFq53H8vRRCVmUjpEDwzgYShfn26qCg3Q5E1BQWIgIQinDFCa4o/vC8 F4nOZ2scoZAp04rF1lyVRhcxAY6HMtWTk+05oFeK5rHDcEMGDI2mna/3Gax4uBR8/1T9 gbdH+lZP4ldtreZzeA2GbiPpXsLhfc7ItYso24tyovOciYE3gnUBntAkeRDl/T4hu1XV kt4q1jh7c1u/B14q3Ju7BICXsiRjQHcwnESNEIrVN/QcWRSmqWPHZfeedtzMTTBHHK64 lzqvy1LEcLlrag9lJOZg7pP8j1Dj2uU48T3AF9ix70OU/wyBbmThYAzjit3rY7DE4vTu IRag== 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s18si13221619otr.172.2020.01.16.07.24.36; Thu, 16 Jan 2020 07:24:49 -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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728977AbgAPPWS (ORCPT + 99 others); Thu, 16 Jan 2020 10:22:18 -0500 Received: from mail-wr1-f67.google.com ([209.85.221.67]:40401 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728899AbgAPPWS (ORCPT ); Thu, 16 Jan 2020 10:22:18 -0500 Received: by mail-wr1-f67.google.com with SMTP id c14so19549796wrn.7 for ; Thu, 16 Jan 2020 07:22:17 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=FTzYumS8YOtnp3SJI0/nekGMa3Yhr59tUFnF0F2ptLU=; b=NdfWRXPZ2Qj+9Ie9rMFmSzcQO6QgaHigrvVSAdbsdKebbsMNYJAc8dIBfNwgHSbZE2 KF12xrtz7HGwweQZh0w9/6yn+BXyeYa9cJs50Uflm6+diOYgvWPv6qFhFtmx9ocec+un XjFHeM8BdOwiqozA0SZe3EVZuUU9X2AjOtXiqBWKGau1CiClMQOubaJ9mmU8fJdk1avT temsNkOEi7hdXRPE3+JE43vHJFgEpcuE2Ugazi6wSyM9cV3kG/4YpEu3IV5qRFEGgXA8 IOTpBumXy7QqU+h4kkcBVgdt6fnRBxV4kwA6NIXEylLqP+ogUdpErIqvtiku6zeLQie/ 7U3g== X-Gm-Message-State: APjAAAWDVfFKqpr5NXV+72uhbmOxT8n1ertZkyqRnBJfTHOZgt79qQNL XV29p8eYTm0C/JVAJKxO1vY= X-Received: by 2002:adf:dfc2:: with SMTP id q2mr3776668wrn.251.1579188136862; Thu, 16 Jan 2020 07:22:16 -0800 (PST) Received: from localhost (prg-ext-pat.suse.com. [213.151.95.130]) by smtp.gmail.com with ESMTPSA id u22sm31139535wru.30.2020.01.16.07.22.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Jan 2020 07:22:16 -0800 (PST) Date: Thu, 16 Jan 2020 16:22:14 +0100 From: Michal Hocko To: David Hildenbrand Cc: Scott Cheloha , linux-kernel@vger.kernel.org, "Rafael J. Wysocki" , Greg Kroah-Hartman , Andrew Morton , nathanl@linux.ibm.com, ricklind@linux.vnet.ibm.com, Scott Cheloha , Donald Dutile Subject: Re: [PATCH v4] drivers/base/memory.c: cache blocks in radix tree to accelerate lookup Message-ID: <20200116152214.GX19428@dhcp22.suse.cz> References: <20191217193238-1-cheloha@linux.vnet.ibm.com> <20200109212516.17849-1-cheloha@linux.vnet.ibm.com> <181caae3-ffb8-c745-a4c9-1aef93ea6dd5@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <181caae3-ffb8-c745-a4c9-1aef93ea6dd5@redhat.com> User-Agent: Mutt/1.12.2 (2019-09-21) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed 15-01-20 20:09:48, David Hildenbrand wrote: > On 09.01.20 22:25, Scott Cheloha wrote: > > Searching for a particular memory block by id is an O(n) operation > > because each memory block's underlying device is kept in an unsorted > > linked list on the subsystem bus. > > > > We can cut the lookup cost to O(log n) if we cache the memory blocks in > > a radix tree. With a radix tree cache in place both memory subsystem > > initialization and memory hotplug run palpably faster on systems with a > > large number of memory blocks. > > > > Signed-off-by: Scott Cheloha > > Acked-by: David Hildenbrand > > Acked-by: Nathan Lynch > > Acked-by: Michal Hocko > > Soooo, > > I just learned that radix trees are nowadays only a wrapper for xarray > (for quite a while already!), and that the xarray interface shall be > used in new code. Good point. I somehow didn't realize this would add more work for a later code refactoring. The mapping should be pretty straightforward. Thanks for noticing! -- Michal Hocko SUSE Labs