regmap: Cut down on the average # of nodes in the rbtree cache
authorDimitris Papastamos <dp@opensource.wolfsonmicro.com>
Fri, 15 Mar 2013 14:54:35 +0000 (14:54 +0000)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Tue, 26 Mar 2013 21:38:15 +0000 (21:38 +0000)
commit0c7ed8563a0282c032936ae1c667498d59691593
tree9c526d8d5cb5ecf4514d93be8071a1ecb66e6389
parent584de329ca43cc6d73eb74885e1d5d9fc0549423
regmap: Cut down on the average # of nodes in the rbtree cache

This patch aims to bring down the average number of nodes
in the rbtree cache and increase the average number of registers
per node.  This should improve general lookup and traversal times.
This is achieved by setting the minimum size of a block within the
rbnode to the size of the rbnode itself.  This will essentially
cache possibly non-existent registers so to combat this scenario,
we keep a separate bitmap in memory which keeps track of which register
exists.  The memory overhead of this change is likely in the order of
~5-10%, possibly less depending on the register file layout.  On my test
system with a bitmap of ~4300 bits and a relatively sparse register
layout, the memory requirements for the entire cache did not increase
(the cutting down of nodes which was about 50% of the original number
compensated the situation).

A second patch that can be built on top of this can look at the
ratio `sizeof(*rbnode) / map->cache_word_size' in order to suitably
adjust the block length of each block.

Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
drivers/base/regmap/regcache-rbtree.c