Kernel/SysFS: Prepend to the custody cache instead of append

Usage patterns mean we are more likely to need a Custody we just cached.
Because lookup walks the list from the beginning, prepending new items
instead of appending means they will be found quicker.

This reduces the number of items in the cache we need to walk by 50% for
boot and application startups.
This commit is contained in:
Andrew January 2021-08-17 09:05:19 +01:00 committed by Gunnar Beutner
parent 86069fa28d
commit f62ac5d81d
Notes: sideshowbarker 2024-07-18 05:35:01 +09:00

View File

@ -40,7 +40,7 @@ KResultOr<NonnullRefPtr<Custody>> Custody::try_create(Custody* parent, StringVie
if (!custody)
return ENOMEM;
all_custodies.append(*custody);
all_custodies.prepend(*custody);
return custody.release_nonnull();
});
}