Page MenuHomeFreeBSD

vm_phys_early_alloc(): Switch order of arguments
AcceptedPublic

Authored by olce on Jan 23 2025, 5:16 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Mar 4, 8:51 AM
Unknown Object (File)
Tue, Mar 4, 8:27 AM
Unknown Object (File)
Tue, Mar 4, 12:29 AM
Unknown Object (File)
Sat, Mar 1, 12:30 PM
Unknown Object (File)
Thu, Feb 27, 2:01 PM
Unknown Object (File)
Sun, Feb 9, 11:09 PM
Unknown Object (File)
Sun, Feb 9, 10:02 AM
Unknown Object (File)
Sun, Feb 9, 4:32 AM

Details

Reviewers
markj
dougm
alc
Summary

It seems more intuitive to specify the requested size first, as the
domain argument is "optional" (the value -1).

Additionally, this will improve consistency with the next commit
introducing vm_phys_early_alloc_ex().

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 62300
Build 59184: arc lint + arc unit

Event Timeline

olce requested review of this revision.Jan 23 2025, 5:16 PM

It seems more intuitive to specify the requested size first.

I don't really see why. The current interface is consistent with other NUMA-aware allocators, e.g., kmem_malloc_domain(), vm_page_alloc_contig_domain(), vm_phys_alloc_pages().

I don't really see why. The current interface is consistent with other NUMA-aware allocators, e.g., kmem_malloc_domain(), vm_page_alloc_contig_domain(), vm_phys_alloc_pages().

The difference with these NUMA-aware allocators is that here specifying the domain is optional (the -1 value), whereas in the former it is mandatory. I usually prefer that "optional" arguments come after mandatory one. I can change that if it's too disturbing. That said, I'm considering just removing the domain argument of vm_phys_early_alloc(), as most callers pass -1, and convert those that do not to use vm_phys_early_alloc_ex() instead.

Would your concern also apply to vm_phys_early_alloc_ex*() in D48635, which has a long list of arguments maybe only mildly comparable to the functions you cited?

olce edited the summary of this revision. (Show Details)

Update description, and the diff as the base has changed.

I don't really see why. The current interface is consistent with other NUMA-aware allocators, e.g., kmem_malloc_domain(), vm_page_alloc_contig_domain(), vm_phys_alloc_pages().

The difference with these NUMA-aware allocators is that here specifying the domain is optional (the -1 value), whereas in the former it is mandatory. I usually prefer that "optional" arguments come after mandatory one. I can change that if it's too disturbing. That said, I'm considering just removing the domain argument of vm_phys_early_alloc(), as most callers pass -1, and convert those that do not to use vm_phys_early_alloc_ex() instead.

That sounds better to me. If a patch is going to introduce churn (i.e., make git blame history harder to follow), I'd prefer some stronger justification, such as simplifying code somehow or making it more consistent in a clear way. I will leave it up to you though, since I already read through it.

This revision is now accepted and ready to land.Tue, Feb 18, 8:30 PM