Page MenuHomeFreeBSD

Refactor uma_zfree_arg()
ClosedPublic

Authored by jeff on Thu, Nov 21, 10:40 PM.

Details

Summary

This is a more significant refactoring than uma_zalloc_arg() because it was in worse shape. We only need the zone lock if we're going to cache a bucket. The crossdomain logic really needed to be simplified and merged with the other case. Fundamentally we're just freeing a bucket and allocating a bucket, no matter which bucket that is.

Diff Detail

Repository
rS FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

jeff created this revision.Thu, Nov 21, 10:40 PM
jeff edited the summary of this revision. (Show Details)Thu, Nov 21, 10:47 PM
jeff added reviewers: markj, glebius, kib, cem.
cem added a comment.Fri, Nov 22, 2:36 AM

The bucket_push and item_dtor refactors look reasonable. I'm not super familiar with this area of code.

markj added inline comments.Fri, Nov 22, 3:34 PM
sys/vm/uma_core.c
3214 ↗(On Diff #64701)

Missing space after while.

3311 ↗(On Diff #64701)

Isn't the use of lockfail redundant? We can write:

if (!ZONE_TRYLOCK(zone)) {
    ZONE_LOCK(zone);
    if (zone->uz_count < zone->uz_count_max)
        ....
}
jeff added a reviewer: rlibby.Sat, Nov 23, 7:40 PM
jeff updated this revision to Diff 64910.Tue, Nov 26, 8:49 PM
jeff edited the summary of this revision. (Show Details)

Review feedback. Pull another function out, zone_free_bucket().

markj accepted this revision.Wed, Nov 27, 5:01 PM
markj added inline comments.
sys/vm/uma_core.c
3317 ↗(On Diff #64910)

Missing parens.

This revision is now accepted and ready to land.Wed, Nov 27, 5:01 PM