Page MenuHomeFreeBSD

vm_reserv: Introduce vm_reserv_populate_range
Needs ReviewPublic

Authored by bnovkov on Oct 18 2024, 5:47 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Dec 19, 5:02 AM
Unknown Object (File)
Wed, Dec 18, 10:26 AM
Unknown Object (File)
Wed, Dec 18, 4:28 AM
Unknown Object (File)
Mon, Dec 16, 3:09 PM
Unknown Object (File)
Thu, Nov 28, 6:36 AM
Unknown Object (File)
Nov 24 2024, 12:15 AM
Unknown Object (File)
Nov 20 2024, 1:50 PM
Unknown Object (File)
Nov 18 2024, 1:56 AM
Subscribers

Details

Reviewers
alc
markj
kib
Summary

This patch adds a routine for populating a range of pages within a reservation.
Instead of repeatedly calling vm_reserv_populate, this routine uses bit_nset to populate the bitmap in one go and updates the reservation's partpopq state only once.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

sys/vm/vm_reserv.c
630

Either use __FUNCTION__ or __func__ consistently, please. __func__ is better because it is standard.

644

Does it make sense to assert that no bits in range are set, before setting them? Otherwise this update might be too optimistic.

sys/vm/vm_reserv.c
641–642

This needs to be within a loop. Multiple pages may need to have their psind updated. For example, the range being populated may span multiple 64 KB pages within a 2 MB reservation.

644

This check exists within the caller.

732–733

Call it here.

839–840

And, call it here too.

Adress @kib 's and @alc 's comments:

  • vm_reserv_populate_range should now properly update psinds for SUBLEVEL-sized superpages
  • Replaced two 'for loop + vm_reserv_populate' constructs with vm_reserv_populate_range
sys/vm/vm_reserv.c
630

Please use __func__ as that is the C standard name.

644–646

I don't think that this loop is correct. Consider the case where start is a multiple of VM_SUBLEVEL_0_NPAGES. The body of the loop is going to set psind on the previous sublevel (64KB) page.

bnovkov added inline comments.
sys/vm/vm_reserv.c
630

While we're here, do you want me to do the same for other occurrences of __FUNCTION__ in vm_reserv.c?

644–646

You're right, thank you for catching this.