HomeFreeBSD

MFC r323307,r323308,r323385,r324378,r325266,r325268,r325433,r325451,r325456,

Description

MFC r323307,r323308,r323385,r324378,r325266,r325268,r325433,r325451,r325456,

r325458:

namecache: factor out dot lookup into a dedicated function

The intent is to move uncommon cases out of the way.
namecache: fold the unlock label into the only consumer

No functional changes.
namecache: clean up struct namecache_ts handling

namecache_ts differs from mere namecache by few fields placed mid struct.
The access to the last element (the name) is thus special-cased.

The standard solution is to put new fields at the very beginning anad
embedd the original struct. The pointer shuffled around points to the
embedded part. If needed, access to new fields can be gained through
__containerof.
namecache: factor out ~MAKEENTRY lookups from the common path

Lookups of the sort are rare compared to regular ones and succesfull ones
result in removing entries from the cache.

In the current code buckets are rlocked and a trylock dance is performed,
which can fail and cause a restart. Fixing it will require a little bit
of surgery and in order to keep the code maintaineable the 2 cases have
to split.
namecache: ncnegfactor 16 -> 12

It is used on each new entry addition to decide whether to whack an existing
negative entry in order to prevent a blow out in size, but the parameter was
set years ago and never revisited.

Building with poudriere results in about 400 evictions per second which
unnecessarily grab entries from the hot list.

With the new parameter there are next to no evictions of the sort.
namecache: fix .. check broken after r324378
namecache: skip locking in cache_purge_negative if there are no entries
namecache: skip locking in cache_lookup_nomakeentry if there is no entry
namecache: wlock buckets in cache_lookup_nomakeentry

Since the case of an empty chain was already covered, it si very likely
that the existing entry is matching. Skipping readlocking saves on lock
upgrade.
namecache: bump numcache after dropping all locks

This makes no difference correctness-wise, but shortens total hold time.

Details

Provenance
mjgAuthored on
Parents
rS327410: Previously, swap_pager_copy() freed swap blocks one at at time, via
Branches
Unknown
Tags
Unknown