Page MenuHomeFreeBSD

Use M_NEXTFIT in memguard.
ClosedPublic

Authored by markj on Sep 18 2018, 6:19 PM.
Tags
None
Referenced Files
F105823487: D17227.diff
Sat, Dec 21, 6:15 AM
Unknown Object (File)
Fri, Dec 13, 3:42 AM
Unknown Object (File)
Thu, Dec 5, 7:16 AM
Unknown Object (File)
Fri, Nov 29, 7:06 PM
Unknown Object (File)
Fri, Nov 29, 6:28 AM
Unknown Object (File)
Thu, Nov 28, 1:41 AM
Unknown Object (File)
Sun, Nov 24, 7:16 PM
Unknown Object (File)
Sun, Nov 24, 6:34 AM
Subscribers

Diff Detail

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

Event Timeline

My comments are not about this patch, but other issues with memguard.

sys/vm/memguard.c
317 ↗(On Diff #48182)

If guard pages are enabled, then this significantly overestimates the amount of physical memory being used.

Moreover, if guard pages are enabled, we should block the allocation of superpage reservations in kmem_back(), because the reservations can never be fully populated or mapped as superpages. (Do we really need unmapped guard pages given the "buffer zone" around the returned memory?)

This revision is now accepted and ready to land.Sep 22 2018, 9:40 PM

Don't fall back to vmem_xalloc(). Instead, factor out handling of
resource shortages into vmem_try_fetch() and use that if the nextfit
search fails. This way we ensure that the cursor is updated on all
M_NEXTFIT allocations, so the policy is applied strictly.

This revision now requires review to proceed.Oct 9 2018, 4:12 PM

Don't fall back to vmem_xalloc(). Instead, factor out handling of
resource shortages into vmem_try_fetch() and use that if the nextfit
search fails. This way we ensure that the cursor is updated on all
M_NEXTFIT allocations, so the policy is applied strictly.

Wrong review. I will update this review with the correct diff plus some
local modifications that I've made.

  • Remove some stale comments referencing the use of a vm_map to manage memguard KVA.
  • Reimplement the mapused sysctl so that we can see how much KVA is consumed at a given point in time.
sys/vm/memguard.c
205 ↗(On Diff #48937)

I would suggest: "... of kernel address space that is managed by a vmem arena."

302 ↗(On Diff #48937)

"... so that we use a consistent value throughout this function."

336 ↗(On Diff #48937)

As an aside, when do_guard is true, it would make sense to disable reservation-based allocation, since the guards will block promotion of the mapping.

markj marked 3 inline comments as done.
  • Address feedback.
sys/vm/memguard.c
336 ↗(On Diff #48937)

Hmm, do we have a mechanism to do that here?

  • Address feedback, this time uploading the correct diff.
alc marked an inline comment as done.
alc added inline comments.
sys/vm/memguard.c
336 ↗(On Diff #48937)

Not on an allocation-by-allocation basis, as opposed to the whole object.

This revision is now accepted and ready to land.Nov 25 2018, 6:20 PM
This revision was automatically updated to reflect the committed changes.