-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 09/07/2010 11:25 AM, Simo Sorce wrote:
Summarizing a discussion between Steve and I on IRC:
the current code throws away the cache as soon as the last client is
finished with it. So if a single client performs multiple operations,
(or multiple client just never hit the same window) it means we have
no0 benefit from the cache as it will be thrown away and rebuilt
multiple times.
Instead of refcounting and discarding it immediately when the refcount
goes to zero we decided that it is probably more CPU efficient to
always just discard when the cache times out. The code is already built
to cope with that case anyway so it should be a minor change.
This means that with some huge directories we will consume a little bit
more memory, but if enumerations are really rarely used this shouldn't
be a huge issue as unused memory can always be swapped out. Besides we
are expiring the cache and freeing it, so if it is only rarely used
then most of the time we will not use all that memory, and if it is
often used our memory consumption will not change much, as we keep
releasing and reacquiring more or less the same amount of memory.
The new patch attached addresses this recommendation as well as Jakub's
comment about initializing enum_cached.
I also noticed that there was a parentage bug with setent_add_ref() in
two places, where the reference was being allocated as a child of the
getent_ctx (gctx or pctx) instead of as a child of the cli_ctx. In this
case, if the client disappeared whild setpwent was still processing, we
would have been accessing freed memory when calling the notifications.
This new patch obsoletes the patches in the thread "Add a setent result
object timeout" as those patches were squashed into this one and
replaced the reference count.
Thank you for the reviews.
- --
Stephen Gallagher
RHCE 804006346421761
Delivering value year after year.
Red Hat ranks #1 in value among software vendors.
http://www.redhat.com/promo/vendor/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Fedora -
http://enigmail.mozdev.org/
iEYEARECAAYFAkyGX9sACgkQeiVVYja6o6OtjACfRwJohpk0fwh+EQnPMP09WYQ6
khEAoJae1eEJ8HiwwlpAoxQjhwwEuHpZ
=nVT3
-----END PGP SIGNATURE-----