kernel/vm.h
About this file
Two constants that select how the sbrk system call grows a process’s memory. They are
shared by both sides of the system call: the user library (user/ulib.c) passes one
of them as the second argument of the sbrk system call, and the kernel’s sys_sbrk
(kernel/sysproc.c) checks which one it received.
- Eager growth allocates and maps the new pages right away (
growproc→uvmalloc). - Lazy growth only raises the process’s size
p->sz. Each new page is allocated the first time the program touches it, when the resulting page fault reachesvmfaultinkernel/vm.c.
Read next: vmfault.
1#define SBRK_EAGER 1