Page MenuHomeFreeBSD

Partial refactoring of uma_zalloc_arg().
ClosedPublic

Authored by jeff on Nov 20 2019, 11:04 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Nov 14, 10:53 AM
Unknown Object (File)
Oct 15 2024, 2:20 AM
Unknown Object (File)
Oct 6 2024, 12:32 PM
Unknown Object (File)
Oct 4 2024, 4:29 PM
Unknown Object (File)
Oct 3 2024, 10:43 AM
Unknown Object (File)
Sep 22 2024, 7:44 AM
Unknown Object (File)
Sep 20 2024, 10:16 AM
Unknown Object (File)
Sep 20 2024, 10:11 AM
Subscribers

Details

Summary

uma_zalloc_arg/zfree_arg have grown out of control. I would like to add another new feature and it may require a custom trip through uma_zalloc and I didn't want to add a bunch of new flag checks.

I attempted to make more of a fastpath without a total hack. This should dramatically reduce the amount of text involved in normal allocations. I moved some of the zitem checks closer to the allocation so they are more encapsulated. I still feel like a fair bit of this should be abstracted into inlines for clarity.

This diff should be functionally identical. I don't think it's perfect but I think it's a step in the right direction. I will be posting another for uma_zfree_arg() soon.

Diff Detail

Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 27669
Build 25870: arc lint + arc unit

Event Timeline

jeff added reviewers: kib, markj, glebius.
jeff set the repository for this revision to rS FreeBSD src repository - subversion.
markj added inline comments.
sys/vm/uma_core.c
2542

Missing parens around the return value.

2551

Add a CRITICAL_ASSERT()?

2585

Make lockfail a bool while you're here?

2631

"let's"

3080

The fragment

<update uz_items>
if (zone->uz_sleepers > 0 && zone->uz_items < zone->uz_max_items)
    wakeup_one(zone);

is pasted all over the place. This might be a good opportunity to fix that.

This revision is now accepted and ready to land.Nov 21 2019, 8:54 PM
This revision now requires review to proceed.Nov 21 2019, 10:40 PM
This revision is now accepted and ready to land.Nov 22 2019, 3:35 PM

First pass, just looked at stuff related to item_ctor.

I wish I'd committed D20722 a couple months ago, although it will be simpler to rewrite now with this as base.

sys/vm/uma_core.c
2449–2451

Prediction is wrong, assuming you mean to predict no failure, and not no constructor.

2452–2454

This is nicer here... I left it out in D20722 because the three call sites have three different responses to error. It would be nice to unify them.

3067–3070

This now double counts the failure (once in item_ctor(), once under fail:).

I am not going to object to you committing yours first and me rebasing on top of that.

In D22470#492498, @jeff wrote:

I am not going to object to you committing yours first and me rebasing on top of that.

Okay. I will fix up the procedure signatures to match yours and update right now.

I am going to commit this soon if there are no objections.

sys/vm/uma_core.c
2449–2451

Constructors are rare except on debug builds.

3080

I think it should be fixed but I will do that in a follow-up commit.

Review feedback. Cosmetic code adjustments.

This revision now requires review to proceed.Nov 26 2019, 8:48 PM
This revision was not accepted when it landed; it landed in state Needs Review.Nov 26 2019, 10:17 PM
This revision was automatically updated to reflect the committed changes.