diff options
author | Justus Winter <4winter@informatik.uni-hamburg.de> | 2014-04-26 12:20:20 +0200 |
---|---|---|
committer | Justus Winter <4winter@informatik.uni-hamburg.de> | 2014-04-29 13:04:44 +0200 |
commit | 97737d1ee3ce95e45a1a4aa636cc2e11a106a9f5 (patch) | |
tree | eaee1a24fd4aa017ee6687b1ff771d465c7e318f /fatfs/pager.c | |
parent | 453e7fc9f7116b4251d6cc5dde5110bdd183797c (diff) |
libports: reduce malloc overhead in _ports_bucket_class_iterate
_ports_bucket_class_iterate creates a snapshot of the buckets hash
table. This is done so that the lock protecting the hash table can be
released while we iterate over the snapshot.
Formerly, a linked list was used to store the snapshot. As the
maximal number of items is known, using an array is much simpler.
_ports_bucket_class_iterate implements both ports_bucket_iterate and
ports_class_iterate. For this change might make ports_class_iterate
less efficient memory-wise if the number of ports belonging to the
class is low with respect to the number of ports in the bucket. If
this happens, we allocate too much. Alleviate this by releasing
unused memory.
On the other hand, the array representation is more compact.
Furthermore a survey of the Hurd code revealed that
ports_class_iterate is rarely used, while ports_bucket_iterate is used
more often, most prominently in paging code.
* libports/bucket-iterate.c (_ports_bucket_class_iterate): Use an
array instead of a linked list.
Diffstat (limited to 'fatfs/pager.c')
0 files changed, 0 insertions, 0 deletions