Page MenuHomeFreeBSD

Partial refactoring of uma_zalloc_arg().
ClosedPublic

Authored by jeff on Nov 20 2019, 11:04 PM.
Tags
None
Referenced Files
F81650030: D22470.diff
Fri, Apr 19, 11:25 AM
Unknown Object (File)
Tue, Apr 9, 8:16 PM
Unknown Object (File)
Feb 22 2024, 12:07 PM
Unknown Object (File)
Feb 22 2024, 12:07 PM
Unknown Object (File)
Feb 22 2024, 12:07 PM
Unknown Object (File)
Feb 22 2024, 12:07 PM
Unknown Object (File)
Feb 22 2024, 12:07 PM
Unknown Object (File)
Feb 11 2024, 2:18 PM
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 27786
Build 25972: 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
2592

Missing parens around the return value.

2601

Add a CRITICAL_ASSERT()?

2618

Make lockfail a bool while you're here?

2664

"let's"

3113

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
2472–2474

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

2475–2477

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.

3098–3101

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
2472–2474

Constructors are rare except on debug builds.

3113

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.