[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5b84a166-c71b-3a41-9e7f-a7624a8441f6@codeaurora.org>
Date: Thu, 1 Feb 2018 12:15:39 +0530
From: Chintan Pandya <cpandya@...eaurora.org>
To: frowand.list@...il.com, Rob Herring <robh+dt@...nel.org>
Cc: devicetree@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] of: cache phandle nodes to decrease cost of
of_find_node_by_phandle()
On 2/1/2018 1:35 AM, frowand.list@...il.com wrote:
> From: Frank Rowand <frank.rowand@...y.com>
> +
> +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
Powered by blists - more mailing lists