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)
Mon, Jan 20, 9:40 PM
Unknown Object (File)
Nov 28 2024, 7:31 AM
Unknown Object (File)
Nov 2 2024, 8:29 PM
Unknown Object (File)
Sep 20 2024, 2:01 AM
Unknown Object (File)
Sep 9 2024, 7:00 PM
Unknown Object (File)
Sep 2 2024, 7:50 AM
Unknown Object (File)
Sep 2 2024, 7:50 AM
Unknown Object (File)
Aug 21 2024, 12:38 AM
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.