Received: by 10.223.176.46 with SMTP id f43csp817055wra; Fri, 26 Jan 2018 07:22:47 -0800 (PST) X-Google-Smtp-Source: AH8x224Q9zFz9ZGqJXm5mRNNgnIhbOZMEnOZpwdkvpRcL1xNUSoP9Twyul8O4IGAG9JjyZWzmf5u X-Received: by 10.99.55.65 with SMTP id g1mr6921768pgn.284.1516980166897; Fri, 26 Jan 2018 07:22:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516980166; cv=none; d=google.com; s=arc-20160816; b=A7RlpHNE5qBuPw9Rw5+B2QKj7DYwhgwB8vX1QmfMV9L1efuJtIotjkaoTUzbZqsnr0 S9Vfb7R/xv2QzBqWQgk8REBM6Jl2Zcrk6CstdJG8X7/2w8tegDoBF0fRFcba7LfO6DxB xo0sS/n/L5DlkFK9aW0gj4xBhW7raUXv0pjT+M+uG1rjWjbQQu0Pn9oelSb6xv2ZfOic R/Fp6LwaU9Z9f3clO1xWCixlOZ5VT8rvvvu7zHV0rBxRCpxobYoSyyY/4LZhQH773STi +Mdu2WqIB7b2vRh3qOxnOUAht3yQVqqFn8oLNFj6l+traLbIfFSd0/z6R9i5Ze9ugodb jz1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dmarc-filter :arc-authentication-results; bh=zHdk9YRPJiuQQ9GqFNwZO8+ODoAAKlD2eOJnUYQ7TWc=; b=cvIdHEEVUXiOmZO1TgpBogY9+9z/fMxyPgK5Ys8gSpRiSGn6a36RBumIf2qG9dBwTC VL/REORG6XTXhoLb/IbWdevJOAgTMRQi2/CiXnCWvPfM35Q/d7M97oiDBoDdu5mbTKQK pgKpMhqn/K1E4luJoHqbIKgeYenrfXK+afBeNlVA1JWSExdlv5lFvDoXZHQYsbU9mwkZ TzpBRdesQ203ZDlSsy43YB/PEMXMGrXdgADqEa9JkBFpqenzAwfbO1MpiMJHDhqQ2ovp kqYMC4cLsLzYZbrtR8QgabIg1BTPo0eQeBYJ6oItA7dzJOO8w3/FKFrmE1LB0uJage5A rygQ== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 129si3120638pgc.441.2018.01.26.07.22.32; Fri, 26 Jan 2018 07:22:46 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753535AbeAZPVZ (ORCPT + 99 others); Fri, 26 Jan 2018 10:21:25 -0500 Received: from mail.kernel.org ([198.145.29.99]:59458 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752495AbeAZPVW (ORCPT ); Fri, 26 Jan 2018 10:21:22 -0500 Received: from mail-qt0-f179.google.com (mail-qt0-f179.google.com [209.85.216.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 9296121798; Fri, 26 Jan 2018 15:21:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9296121798 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=robh+dt@kernel.org Received: by mail-qt0-f179.google.com with SMTP id s39so2073123qth.7; Fri, 26 Jan 2018 07:21:21 -0800 (PST) X-Gm-Message-State: AKwxytcuaHzJRBGjwVfHXrG2RjK+sQFlaCTu0R4XooIdO4YaJvNUF/oa qwEtM3TySGe2KZPm74U8LS7qvTul/HLDOBdmZw== X-Received: by 10.200.22.187 with SMTP id r56mr22531829qtj.190.1516980080828; Fri, 26 Jan 2018 07:21:20 -0800 (PST) MIME-Version: 1.0 Received: by 10.12.147.20 with HTTP; Fri, 26 Jan 2018 07:21:00 -0800 (PST) In-Reply-To: References: <1516875247-19599-1-git-send-email-cpandya@codeaurora.org> From: Rob Herring Date: Fri, 26 Jan 2018 09:21:00 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] of: use hash based search in of_find_node_by_phandle To: Chintan Pandya Cc: Frank Rowand , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , "linux-kernel@vger.kernel.org" , linux-arm-msm Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jan 26, 2018 at 1:22 AM, Chintan Pandya wrote: > On 1/25/2018 8:20 PM, Rob Herring wrote: >> >> On Thu, Jan 25, 2018 at 4:14 AM, Chintan Pandya >> wrote: >>> [...] >> I'd guess that there's really only a few phandle lookups that occur >> over and over. > > On my system, there are ~6.7k calls of this API during boot. And after boot it will be near 0 yet we carry the memory usage forever. >> The clock controller, interrupt controller, etc. What >> if you just had a simple array of previously found nodes for a cache >> and of_find_node_by_phandle can check that array first. Probably 8-16 >> entries would be enough. > > I clearly see repeat calling with same phandle. But I have few hundreds of > nodes. > I see hashing as generic optimization which applies equally good to all > sized DT. > Using ~4KB more size to save 400 ms is a good trade-off, I believe. But if you can use 200 bytes and save 350 ms, that would be a better trade off IMO. But we don't know because we have no data. Rob