Received: by 10.223.185.116 with SMTP id b49csp6187683wrg; Wed, 28 Feb 2018 05:28:39 -0800 (PST) X-Google-Smtp-Source: AH8x226y8Q9W0ZNvGnrO239a6FRdhtK9o5ImFh+NChz0qT1Ar0vfudtSWvwCkE78PpjlRcUYREmB X-Received: by 10.98.204.69 with SMTP id a66mr17777417pfg.33.1519824519414; Wed, 28 Feb 2018 05:28:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519824519; cv=none; d=google.com; s=arc-20160816; b=ll+N92H3NbPjxWaCiilMQK0PBwUxWReYVUYj2TJdMNcv4s+OBpQiMnn/auk86nuS3+ vkwlufYWLv0X+XixDziDoB+cV1IQKXz6oGnKPRdMVPE/3tthRYj0cU39XEBZaBOEltzx PNaY8qJyXi10qnJbiwEksTjnwLGI56g1Bd7qwFvYnbseh7c6++QjK6Vcvsr6qbzgAinS qOUHuUVdoOeCorEJ0Afj4v+ku2Uc/gMxln7XKzaWcNibHfrn2tqdtj1vcJl21OdEtdaa ZMPXLk9i0GEpVyp8KGPn+RBEBWDYYeQL8L0d/DP1BASM7WB/lFnvSY3njP4Ox5AR7eOk 1Wiw== 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:dmarc-filter :dkim-signature:dkim-signature:arc-authentication-results; bh=BsXkP5mnsdphLPb8Vf1yA46faRpw29xvSD80oaMPSBc=; b=UhSj8GC7DVeqECADUQVFxH8AOiqbaPNLG0jIDFP3uhKDj7xlAJFQV+dqYCY7xnXfwl aQvhvrV4cI8H/lQvnHD2xd7JyMiqjXAeM1dc+Qa9mSR9VeLRwsZAEnXz7woYjo2DWnI/ jxnmF+fMY1ZVBfSmfyWk30gHAAmMnwee9USncMArpkLKEKJazlzQXHkOZLX3UvEIrv+O 7McI819ojcd1WQKKcaJ3DSpYCZf60ypqM7J2xVdj80xSd3pcYV0dzINkVTdTRZUv2w/q QnFY2Ow1BC1/mthPHWd0xPZEwrpFTJwRcXBoGSNgrt+1lQNPx/UR0ErWZ3E+wVD1kmuc uoLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=U6gkpZRi; dkim=pass header.i=@codeaurora.org header.s=default header.b=U6gkpZRi; 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 s19si988778pgo.626.2018.02.28.05.28.24; Wed, 28 Feb 2018 05:28:39 -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=@codeaurora.org header.s=default header.b=U6gkpZRi; dkim=pass header.i=@codeaurora.org header.s=default header.b=U6gkpZRi; 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 S1752686AbeB1N1O (ORCPT + 99 others); Wed, 28 Feb 2018 08:27:14 -0500 Received: from smtp.codeaurora.org ([198.145.29.96]:52106 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752619AbeB1N1N (ORCPT ); Wed, 28 Feb 2018 08:27:13 -0500 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id ADF60607E5; Wed, 28 Feb 2018 13:27:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1519824432; bh=6Y+GFycjEKmIZ8w5EluaJujEQS6Xv41e9XNIsXULKZY=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=U6gkpZRi1XuBIww2MSEtvs8VNqBOt+N6IkqSmK/YZydKF5huYQNzCbObjtKQ1LkyQ /XxX1iXURV07H4mi3WAGDQzc0ITaKcklWRPkE8/8xWEPX7jkuuhWG2/9ubfWePY0Sr rPQK50MaNGpWszHHfjrcgaJMWmwByuXmPIdaTZic= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0 Received: from [10.204.79.109] (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: cpandya@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id DB2E9602BA; Wed, 28 Feb 2018 13:27:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1519824432; bh=6Y+GFycjEKmIZ8w5EluaJujEQS6Xv41e9XNIsXULKZY=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=U6gkpZRi1XuBIww2MSEtvs8VNqBOt+N6IkqSmK/YZydKF5huYQNzCbObjtKQ1LkyQ /XxX1iXURV07H4mi3WAGDQzc0ITaKcklWRPkE8/8xWEPX7jkuuhWG2/9ubfWePY0Sr rPQK50MaNGpWszHHfjrcgaJMWmwByuXmPIdaTZic= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org DB2E9602BA Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=cpandya@codeaurora.org Subject: Re: [PATCH v3] of: cache phandle nodes to reduce cost of of_find_node_by_phandle() To: frowand.list@gmail.com, Rob Herring Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org References: <1518655979-10910-1-git-send-email-frowand.list@gmail.com> From: Chintan Pandya Message-ID: Date: Wed, 28 Feb 2018 18:57:08 +0530 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <1518655979-10910-1-git-send-email-frowand.list@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed 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 2/15/2018 6:22 AM, frowand.list@gmail.com wrote: > +static void of_populate_phandle_cache(void) > +{ > + unsigned long flags; > + u32 cache_entries; > + struct device_node *np; > + u32 phandles = 0; > + > + raw_spin_lock_irqsave(&devtree_lock, flags); > + > + kfree(phandle_cache); > + phandle_cache = NULL; > + > + for_each_of_allnodes(np) > + if (np->phandle && np->phandle != OF_PHANDLE_ILLEGAL) > + phandles++; > + > + cache_entries = roundup_pow_of_two(phandles); > + phandle_cache_mask = cache_entries - 1; > + > + phandle_cache = kcalloc(cache_entries, sizeof(*phandle_cache), > + GFP_ATOMIC); > + NULL check of phandle_cache would be good to have. > + for_each_of_allnodes(np) > + if (np->phandle && np->phandle != OF_PHANDLE_ILLEGAL) > + phandle_cache[np->phandle & phandle_cache_mask] = np; > + > + raw_spin_unlock_irqrestore(&devtree_lock, flags); > +} Chintan -- Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project