linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v4 0/2] of: cache phandle nodes to reduce cost of of_find_node_by_phandle()
@ 2018-02-28 19:04 frowand.list
  2018-02-28 19:04 ` [PATCH v4 1/2] " frowand.list
  2018-02-28 19:04 ` [PATCH v4 2/2] of: add early boot allocation of of_find_node_by_phandle() cache frowand.list
  0 siblings, 2 replies; 10+ messages in thread
From: frowand.list @ 2018-02-28 19:04 UTC (permalink / raw)
  To: Rob Herring, cpandya; +Cc: devicetree, linux-kernel

From: Frank Rowand <frank.rowand@sony.com>

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.

Size and performance data is in patch 1/2 comments

Changes since v3:
  - of_populate_phandle_cache(): add check for failed memory allocation
  - add patch 2/2 into series instead of as a standalone patch that was
    dependent on patch 1/2 of this series

Changes since v2:
  - add mask to calculation of phandle cache entry
  - which results in better overhead reduction for devicetrees with
    phandle properties not allocated in the monotonically increasing
    range of 1..n
  - due to mask, number of entries in cache potentially increased to
    next power of two
  - minor fixes as suggested by reviewers
  - no longer using live_tree_max_phandle() so do not move it from
    drivers/of/resolver.c to drivers/of/base.c

Changes since v1:
  - change short description from
    of: cache phandle nodes to reduce cost of of_find_node_by_phandle()
  - rebase on v4.16-rc1
  - reorder new functions in base.c to avoid forward declaration
  - add locking around kfree(phandle_cache) for memory ordering
  - add explicit check for non-null of phandle_cache in
    of_find_node_by_phandle().  There is already a check for !handle,
    which prevents accessing a null phandle_cache, but that dependency
    is not obvious, so this check makes it more apparent.
  - do not free phandle_cache if modules are enabled, so that
    cached phandles will be available when modules are loaded



Frank Rowand (2):
  of: cache phandle nodes to reduce cost of of_find_node_by_phandle()
  of: add early boot allocation of of_find_node_by_phandle() cache

 drivers/of/base.c       | 119 ++++++++++++++++++++++++++++++++++++++++++++++--
 drivers/of/fdt.c        |   2 +
 drivers/of/of_private.h |   5 ++
 drivers/of/resolver.c   |   3 --
 4 files changed, 122 insertions(+), 7 deletions(-)

-- 
Frank Rowand <frank.rowand@sony.com>

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2018-03-03  7:39 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-28 19:04 [PATCH v4 0/2] of: cache phandle nodes to reduce cost of of_find_node_by_phandle() frowand.list
2018-02-28 19:04 ` [PATCH v4 1/2] " frowand.list
2018-02-28 19:31   ` Andy Shevchenko
2018-02-28 19:44     ` Frank Rowand
2018-02-28 20:19       ` Andy Shevchenko
2018-02-28 20:54         ` Rob Herring
2018-02-28 20:58         ` Frank Rowand
2018-02-28 19:04 ` [PATCH v4 2/2] of: add early boot allocation of of_find_node_by_phandle() cache frowand.list
2018-03-03  5:25   ` [of] b013aa45d2: kernel_BUG_at_arch/x86/mm/physaddr.c kernel test robot
2018-03-03  7:38   ` [PATCH v4 2/2] of: add early boot allocation of of_find_node_by_phandle() cache kbuild test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).