Page MenuHomeFreeBSD

alloc memory from reservation before breaking it
ClosedPublic

Authored by dougm on Dec 24 2021, 5:33 AM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Oct 31, 5:23 PM
Unknown Object (File)
Wed, Oct 16, 7:17 AM
Unknown Object (File)
Sep 25 2024, 10:30 AM
Unknown Object (File)
Sep 25 2024, 10:18 AM
Unknown Object (File)
Sep 24 2024, 2:57 AM
Unknown Object (File)
Sep 21 2024, 12:10 AM
Unknown Object (File)
Sep 8 2024, 7:58 PM
Unknown Object (File)
Aug 20 2024, 7:53 PM
Subscribers

Details

Summary

vm_reserv_reclaim_contig breaks a reservation with enough free space to satisfy an allocation request and returns the free space to the buddy allocator. Change the function to allocate the request memory from the reservation before breaking it, and returning that memory to the caller. That avoids a second call to the buddy allocator and guarantees successful allocation after breaking the reservation, where that success is not currently guaranteed.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

dougm requested review of this revision.Dec 24 2021, 5:33 AM
dougm created this revision.
sys/vm/vm_page.c
2200

This has to move. If "reclaim" succeeds, you don't want to do this.

Correct page accounting problem.

This revision is now accepted and ready to land.Dec 24 2021, 5:38 PM
sys/vm/vm_page.c
2205–2208

The indentation looks wrong.

2229–2231

As an aside, I find this KASSERT confusing because we disallow VM_ALLOC_WAITOK in the very first KASSERT.

2246

As an aside, I don't see the point of this loop because because we disallow VM_ALLOC_WAITOK in the very first KASSERT. Kostik? Mark?

sys/vm/vm_reserv.c
1390–1397

This could all be performed after the reservation is unlocked.

1402

This can be done before marking the pages as allocated.

dougm marked 3 inline comments as done.

Fix indentation. Move some code out of the scope of locks, as suggested.

This revision now requires review to proceed.Dec 24 2021, 6:37 PM
This revision is now accepted and ready to land.Dec 24 2021, 6:57 PM
This revision was automatically updated to reflect the committed changes.