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)
Fri, Apr 19, 4:21 AM
Unknown Object (File)
Fri, Apr 12, 1:47 PM
Unknown Object (File)
Fri, Apr 12, 1:46 PM
Unknown Object (File)
Feb 12 2024, 12:16 PM
Unknown Object (File)
Jan 15 2024, 1:08 AM
Unknown Object (File)
Dec 20 2023, 3:19 AM
Unknown Object (File)
Dec 16 2023, 12:04 PM
Unknown Object (File)
Dec 5 2023, 12:34 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.