Page MenuHomeFreeBSD

Eliminate an unnecessary parameter to kmem_malloc_domain()
ClosedPublic

Authored by alc on Aug 15 2018, 5:14 AM.
Tags
None
Referenced Files
Unknown Object (File)
Dec 20 2023, 4:46 AM
Unknown Object (File)
Dec 17 2023, 5:43 AM
Unknown Object (File)
Aug 2 2023, 3:19 AM
Unknown Object (File)
Aug 2 2023, 3:17 AM
Unknown Object (File)
Aug 2 2023, 3:13 AM
Unknown Object (File)
Aug 2 2023, 3:06 AM
Unknown Object (File)
Jul 12 2023, 1:20 AM
Unknown Object (File)
May 27 2023, 5:27 PM
Subscribers

Details

Summary

The arena parameter to kmem_malloc_domain() is unnecessary. The domain and flags parameters suffice. In fact, the related functions kmem_alloc_{attr,contig}_domain() don't have this parameter.

The above stylistic argument aside, my real motivation for making this change now is that I want to implement stronger segregation for the physical memory that backs UMA _NOFREE zones. (See D16620 for a hackish proof-of-concept.) And, I don't want to have to modify affected kmem_malloc_domain() callers to pass in yet a different arena, when that parameter really serves no purpose.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

This revision is now accepted and ready to land.Aug 15 2018, 12:58 PM

Do you plan to update the kmem_malloc() prototype at some point?

Do you plan to update the kmem_malloc() prototype at some point?

I would happily see the arena argument removed from all of these functions before we branch 12.x. kmem_free() is the only one where the arena isn't entirely redundant. Essentially, kmem_free() uses the arena as a flag to determine whether the addresses should be returned to the domain's kernel arena or rwx arena.

Do we have a consensus?

In D16713#355892, @alc wrote:

Do you plan to update the kmem_malloc() prototype at some point?

I would happily see the arena argument removed from all of these functions before we branch 12.x. kmem_free() is the only one where the arena isn't entirely redundant. Essentially, kmem_free() uses the arena as a flag to determine whether the addresses should be returned to the domain's kernel arena or rwx arena.

Do we have a consensus?

Are you proposing that we keep the arena parameter to kmem_free()? I'd rather see it converted to a set of malloc flags (with M_EXEC being the only valid flag for now). Either way, I'd also be happy to remove the arena argument from the other functions.

In D16713#355892, @alc wrote:

Do you plan to update the kmem_malloc() prototype at some point?

I would happily see the arena argument removed from all of these functions before we branch 12.x. kmem_free() is the only one where the arena isn't entirely redundant. Essentially, kmem_free() uses the arena as a flag to determine whether the addresses should be returned to the domain's kernel arena or rwx arena.

Do we have a consensus?

Are you proposing that we keep the arena parameter to kmem_free()?

No.

I'd rather see it converted to a set of malloc flags (with M_EXEC being the only valid flag for now). Either way, I'd also be happy to remove the arena argument from the other functions.

Alternatively, we could avoid the need for a flags parameter by marking the pages. I would compare this to the way that kmem_free() recovers the domain to which it should return the addresses.

In D16713#355911, @alc wrote:

I'd rather see it converted to a set of malloc flags (with M_EXEC being the only valid flag for now). Either way, I'd also be happy to remove the arena argument from the other functions.

Alternatively, we could avoid the need for a flags parameter by marking the pages. I would compare this to the way that kmem_free() recovers the domain to which it should return the addresses.

I'm a bit hesitant about the idea of marking the physical page to reflect a property of its mapping, but I think that approach would work fine too.

This revision was automatically updated to reflect the committed changes.