VM_MAP_SYNC(9)

πŸ’– VM_MAP_SYNC(9) πŸ’–

okay bestie, this is a page from the Kernel Developer's Manual β€” section 9, kernel nerd territory β€” and it's all about vm_map_sync, the little function that makes sure your dirty pages go home to their pager. 🏠✨


🌸 NAME 🌸

vm_map_sync β€” push dirty pages to their pager πŸ’…


✨ SYNOPSIS ✨

#include <sys/param.h>
#include <vm/vm.h>
#include <vm/vm_map.h>

int
vm_map_sync(vm_map_t map, vm_offset_t start, vm_offset_t end,
    boolean_t syncio, boolean_t invalidate);

like. look at those args. four whole parameters. she's serving function signature. πŸŽ€


πŸ¦‹ DESCRIPTION πŸ¦‹

So here's the tea: vm_map_sync() grabs every dirty cached page hanging out in the range from start to end inside map, and forces them all to be pushed to their underlying pager. no page left behind, fr fr. πŸ’–

If syncio is TRUE, those dirty pages get written synchronously. like, right now. no waiting around, no vibes-based timing, just write. ⚑

If invalidate is TRUE, any cached pages also get freed. bye bye, you will not be missed. 🫢

⚠️ bestie listen up, this is the important part: the range you provide must be contiguous. It MUST NOT contain holes. And it MUST NOT contain any sub-map entries. not even one. the function will simply not be having it. 😭

πŸ‘‘ RETURN VALUES πŸ‘‘

vm_map_sync() returns KERN_SUCCESS when everything went great. slay. ✨

Otherwise? yeah, it's giving errors:

  • KERN_INVALID_ADDRESS gets returned if the function ran into a sub-map entry. πŸ™ˆ
  • KERN_INVALID_ARGUMENT gets returned if the function found a hole in the region you provided, or if an entry could not be found for the given start address. πŸ’€

πŸ’œ SEE ALSO πŸ’œ

go read that one too, iykyk. 🧚


πŸŽ€ AUTHORS πŸŽ€

This manual page was written by Bruce M Simpson <bms@spc.org>. king behavior honestly. πŸ‘‘


and that's the whole page, bestie!! this one's from Debian, dated July 9, 2011, and it's page VM_MAP_SYNC(9) of the Kernel Developer's Manual. mwah. πŸ’‹πŸŒˆβ­

πŸ“¦ where this page comes from