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)
Wed, Nov 20, 1:50 PM
Unknown Object (File)
Mon, Nov 18, 1:56 AM
Unknown Object (File)
Mon, Nov 18, 1:38 AM
Unknown Object (File)
Sat, Nov 16, 11:21 PM
Unknown Object (File)
Sat, Nov 16, 10:52 PM
Unknown Object (File)
Sat, Nov 16, 10:42 PM
Unknown Object (File)
Sat, Nov 9, 3:27 PM
Unknown Object (File)
Wed, Nov 6, 5:59 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

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.

728–729

Call it here.

836–837

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.