Received: by 10.223.176.5 with SMTP id f5csp2364105wra; Wed, 31 Jan 2018 22:46:23 -0800 (PST) X-Google-Smtp-Source: AH8x225LE0zIbppNUw/Q+c5UEJ6yrMJDbw1qrKsPu70GHjTHfaXVTDKJuk8KODuKXnTZYaMf7IAp X-Received: by 10.101.96.132 with SMTP id t4mr27729944pgu.58.1517467583674; Wed, 31 Jan 2018 22:46:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517467583; cv=none; d=google.com; s=arc-20160816; b=M0wt4ntchE+sROsQmPGnBVO2SJZECJVMiKf3SRMRjYVdgOzyQ4L0ZIOcYE7uAmLjqI L44AybayEInd8Xv2dH9yapaNYdBvYcgBoBsTMRlaKLgffsq0H0c2QZ2sMyM0p2ltXSj4 SjrU2qFa56ep35kx6rxahb6/5MrC0NLr1llxssvVqfI/0E/ht6v70Vy+L1q1+I8fyod9 6OtNe6X9TxkdD9tUHnGkqy8VUrl7HB4ax7GHJ975lLoDvk65qI5jKeUq6VwNMxM1qNQa wAsslB4c8KsUDXY7MXNfpwVFHlkUXR4KvaK7WwC9/3+yF8btU64QeH6PvYOvqKwoHHZL Mu4g== 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=bVGET3Dx9MMndd7q+vre+IQAr2LtnErmI51QbL8qiAQ=; b=jZdOrIYPZLxxm03bw4R9AR0bGeQM9zby4D2Ztxl8yt+xpaW2uRfyVd2S61kh9hYaK9 64NRe9KLDXskHL0NkhkYbYKSw55bqJiVWallYb5bc0shhsdOWMHuiYl8vs1MlzW975lN sTb1MQKpw2xJxm5J0F/zguKI6JPekQ5gpZKZn0idUXACuklbJxp2OCwAXR2wjdLUuRcB UUk29ErdvVVH/K614bncjBY0875AOd4FIDs5oewAwGNWWXgGgSfluSzjdJiS4V8fc4Oj GftRIJ44Pk1zrpX3H6UPPQjQKLaHKNNvJihBP4StN0JfqiNst1UHdm5xfEHJDyeC2uFg mHbA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=C5gmJFU/; dkim=pass header.i=@codeaurora.org header.s=default header.b=achh9mXH; 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 e15si12489445pgu.356.2018.01.31.22.46.08; Wed, 31 Jan 2018 22:46:23 -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=C5gmJFU/; dkim=pass header.i=@codeaurora.org header.s=default header.b=achh9mXH; 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 S1751519AbeBAGpp (ORCPT + 99 others); Thu, 1 Feb 2018 01:45:45 -0500 Received: from smtp.codeaurora.org ([198.145.29.96]:39222 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751119AbeBAGpn (ORCPT ); Thu, 1 Feb 2018 01:45:43 -0500 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 4EBE2609D1; Thu, 1 Feb 2018 06:45:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1517467543; bh=EIlKRw+QMg+i6LBf70ThbGJu4yLY4Dbkrt36fCipx0g=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=C5gmJFU/MzsSfEiCk3+ibGjwm5ii2EtOvplA0S6M1zbrLzXhTG73Ye66DLfka1pXi voHSXBwXXC4SKp7cC40qa5+iwX7ubF3E4wUyFRjmG4R+PBYpSwLuLVfOZ8sl5Rdkih R+4GInwcVSRkaEHnGLHrrmKnniCG84g21ieW6Hv4= 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.100.248] (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 98C726076A; Thu, 1 Feb 2018 06:45:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1517467542; bh=EIlKRw+QMg+i6LBf70ThbGJu4yLY4Dbkrt36fCipx0g=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=achh9mXHsGHlhGiXZ9Cz9b8WpqUQwUjGOTmAMolKSnikNHwGhVZT3Aq5CFtmAhKox 3H2BHLS+Nno2VhRq262dZmYNIL279djruaS0VRQDNN8x5gD2mp3u7xDmX6r9zBO5ai 4dkg2Hoarj2/B+Ik3YSkuFQ7y3H8w9nv0ND8wuvQ= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 98C726076A 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] of: cache phandle nodes to decrease 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: <1517429142-25727-1-git-send-email-frowand.list@gmail.com> From: Chintan Pandya Message-ID: <5b84a166-c71b-3a41-9e7f-a7624a8441f6@codeaurora.org> Date: Thu, 1 Feb 2018 12:15:39 +0530 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: <1517429142-25727-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/1/2018 1:35 AM, frowand.list@gmail.com wrote: > From: Frank Rowand > + > +static void of_populate_phandle_cache(void) > +{ > + unsigned long flags; > + phandle max_phandle; > + u32 nodes = 0; > + struct device_node *np; > + > + if (phandle_cache) > + return; > + > + max_phandle = live_tree_max_phandle(); > + > + raw_spin_lock_irqsave(&devtree_lock, flags); > + > + for_each_of_allnodes(np) > + nodes++; > + > + /* sanity cap for malformed tree */ > + if (max_phandle > nodes) > + max_phandle = nodes; Shouldn't we speak up about this in kernel log ? May be WARN_ON() ? > + > + phandle_cache = kzalloc((max_phandle + 1) * sizeof(*phandle_cache), > + GFP_KERNEL); kzalloc (might_sleep) in critical context will break. Anyways, will fix this locally and share test results. Thanks, Chintan -- Qualcom India Private Limited, on behalf of Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project