Received: by 10.223.185.111 with SMTP id b44csp939128wrg; Fri, 9 Mar 2018 17:22:04 -0800 (PST) X-Google-Smtp-Source: AG47ELuNts4wBCwnlZWqK4ME9VUqjmCExNfhMyt/0k5McBmHGxOv1/sqN+62FJqSdhXk94HQ8u+f X-Received: by 2002:a17:902:724b:: with SMTP id c11-v6mr466661pll.352.1520644924185; Fri, 09 Mar 2018 17:22:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520644924; cv=none; d=google.com; s=arc-20160816; b=ruHIfFwei0/86GYdWEKQ3Qpd3GfKHnVQ9l182vMyBUiykzER1Yf69BJ3kPWIKYjwHc HCRQSSvnLSb5A5aCsKVf/nsofNqNzeC3DFtBHCbG4J+lbMrw2gSU4kp6rXwAa4x5pq+t ik0TEujuV215fuudXuFNLq19tOpcb3lOpWpXiLmfpGaMQVU2dhdw5Rg/5y5C4+40+dS6 DnTvRvkNiatAWu3xhEhtwz7g+h/ymPKlMwUEsiYYKa1iPTr0b5tZ6TtIaarS2TKqph5w lPtYmoqkhJJC6DJVNAy8eVkwl2DXEUQbC+WwE9n3VcsDLheGmI01mgidjv8VO5lwXO3l 6QhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=rmZ54qvi6DQIqPR1lf82MLBhL9JtuT1vv+yaM1SCSHE=; b=vZdOu2hJIYk+13EeExFMRfZ+V3b4K8t8imY8ExJ/lVnl5zQhCLdENQcel8HxUYus0V N+FZx076F7/4OPihKUhWt0RfHg4PVu0ao68L9DT6moa3aLO4cR9NiOaYy4URjAwBdoHQ 35gcdzR2W4lQ4hqFWQLFgDnBt8dcyPU8rNs3gn9lO7K9wGV3lwU8F5l4vZsBpfuVdGUS dKqB356Fesw0vgm9848xwXL9gAqa72Wk3ntcSDbN6o4Gnt7ZkV31wzWRWnCePnu63UXE XxB8eqaJKcNn0uc1oiVMG7Z3jmuHZKCCUgR76KQwLd0FjbA9V2HYE4VdG31T6NtnClHt cp+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=AprwtA3S; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b6si1544936pgr.640.2018.03.09.17.21.48; Fri, 09 Mar 2018 17:22:04 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=AprwtA3S; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751495AbeCJBUx (ORCPT + 99 others); Fri, 9 Mar 2018 20:20:53 -0500 Received: from mail-pf0-f195.google.com ([209.85.192.195]:43950 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751231AbeCJBUw (ORCPT ); Fri, 9 Mar 2018 20:20:52 -0500 Received: by mail-pf0-f195.google.com with SMTP id j2so1977987pff.10; Fri, 09 Mar 2018 17:20:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=rmZ54qvi6DQIqPR1lf82MLBhL9JtuT1vv+yaM1SCSHE=; b=AprwtA3SFaToSxPlw8aYzl3kCAA1I0OuGJq/E8CWIRXHSxUTuWA8t18ii6V+axensL hlZPQKgDdrjtTFeOmzsrsUDIwFcJc1UDECpGWjkfa1tRC4DWfdrIroZjOkEG9CJeD+DU EQ1UYg3+7zrK9qxT7djLG7va6MkYOucIcmm6eaJWiqsY8S4g6KquIJ1oN2iAqGLbegEe /cXShfgpSA8+ohs88Afx1WadSdwvBtXSeS+TqiR8r9sEckzKBQFr4ZVsRVnHCdUr1emC VfAxYLY1y0ZcT19g/vDOMyYD3lmGVwuq4s3Yp89xGLFe0NURznEe7hKJLza6HeLlFFGS 6DiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=rmZ54qvi6DQIqPR1lf82MLBhL9JtuT1vv+yaM1SCSHE=; b=TlAW27l1/FE6hI2PeS0Tj04ZQF6xitOaTNrZOVEyV3vOY9gKm3BuYD0e9I9NTYRpwy XTnKf+RSsRTn/Zgj7eRvqhf6rCjRbYxjftJyT+HGL0g/ks0pJ5vAJJ+J+/IVHZa+WGSZ 82AcfkzQ0IBPeJi0AP8Ab2zL1a1oQkqEndVs3nG6ctuIt24tSWl5rCHeHUIgk2+JZJR/ K8sO3UW0fJ70f1oCmNCBzPXC8E8zrTBUKw4zwQcQpmeV+SB0yLqziNTp65y3+vzJzg8G zjDWLVVzzvmO0joA4Gk6rRtrCqgoEmWoVsbwWnxhgJE3MQNLnIFoX1jrveLdxzBg108Q B/2w== X-Gm-Message-State: AElRT7GoW88dfUzfwhrQllH8fcg1uIWcYybtZRsChTJMzRlSmQh7nuQd IwTUdCIaoghqIlYEG6l6pbo= X-Received: by 10.99.96.193 with SMTP id u184mr380895pgb.103.1520644851610; Fri, 09 Mar 2018 17:20:51 -0800 (PST) Received: from [192.168.1.70] (c-73-93-215-6.hsd1.ca.comcast.net. [73.93.215.6]) by smtp.gmail.com with ESMTPSA id v12sm5761177pfd.141.2018.03.09.17.20.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 09 Mar 2018 17:20:51 -0800 (PST) Subject: Re: [PATCH v5 1/3] of: cache phandle nodes to reduce cost of of_find_node_by_phandle() To: Rob Herring Cc: cpandya@codeaurora.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org References: <1520208889-3908-1-git-send-email-frowand.list@gmail.com> <1520208889-3908-2-git-send-email-frowand.list@gmail.com> <20180309230346.7mphnvsdxugpmtmc@rob-hp-laptop> From: Frank Rowand Message-ID: Date: Fri, 9 Mar 2018 17:20:50 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <20180309230346.7mphnvsdxugpmtmc@rob-hp-laptop> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 03/09/18 15:03, Rob Herring wrote: > On Sun, Mar 04, 2018 at 04:14:47PM -0800, frowand.list@gmail.com wrote: >> From: Frank Rowand >> >> Create a cache of the nodes that contain a phandle property. Use this >> cache to find the node for a given phandle value instead of scanning >> the devicetree to find the node. If the phandle value is not found >> in the cache, of_find_node_by_phandle() will fall back to the tree >> scan algorithm. >> >> The cache is initialized in of_core_init(). >> >> The cache is freed via a late_initcall_sync() if modules are not >> enabled. >> >> If the devicetree is created by the dtc compiler, with all phandle >> property values auto generated, then the size required by the cache >> could be 4 * (1 + number of phandles) bytes. This results in an O(1) >> node lookup cost for a given phandle value. Due to a concern that the >> phandle property values might not be consistent with what is generated >> by the dtc compiler, a mask has been added to the cache lookup algorithm. >> To maintain the O(1) node lookup cost, the size of the cache has been >> increased by rounding the number of entries up to the next power of >> two. >> >> The overhead of finding the devicetree node containing a given phandle >> value has been noted by several people in the recent past, in some cases >> with a patch to add a hashed index of devicetree nodes, based on the >> phandle value of the node. One concern with this approach is the extra >> space added to each node. This patch takes advantage of the phandle >> property values auto generated by the dtc compiler, which begin with >> one and monotonically increase by one, resulting in a range of 1..n >> for n phandle values. This implementation should also provide a good >> reduction of overhead for any range of phandle values that are mostly >> in a monotonic range. >> >> Performance measurements by Chintan Pandya >> of several implementations of patches that are similar to this one >> suggest an expected reduction of boot time by ~400ms for his test >> system. If the cache size was decreased to 64 entries, the boot >> time was reduced by ~340 ms. The measurements were on a 4.9.73 kernel >> for arch/arm64/boot/dts/qcom/sda670-mtp.dts, contains 2371 nodes and >> 814 phandle values. >> >> Reported-by: Chintan Pandya >> Signed-off-by: Frank Rowand >> --- > > I've applied this one, but not the others. > > Rob > Thank you. I'll let the other two disappear into a distant memory. -Frank