kernel/vm.c
uint64
uvmdealloc(pagetable_t pagetable, pagetable_t kpagetable, uint64 oldsz, uint64 newsz)
{
  if(newsz >= oldsz)
    return oldsz;

  if(PGROUNDUP(newsz) < PGROUNDUP(oldsz)){
    int npages = (PGROUNDUP(oldsz) - PGROUNDUP(newsz)) / PGSIZE;
    vmunmap(kpagetable, PGROUNDUP(newsz), npages, 0);
    vmunmap(pagetable, PGROUNDUP(newsz), npages, 1);
  }

  return newsz;
}
// Deallocate user pages to bring the process size from oldsz to
// newsz.  oldsz and newsz need not be page-aligned, nor does newsz
// need to be less than oldsz.  oldsz can be larger than the actual
// process size.  Returns the new process size.
Deallocate user pages to bring the process size from oldsz to
newsz.  oldsz and newsz need not be page-aligned, nor does newsz
need to be less than oldsz.  oldsz can be larger than the actual
process size.  Returns the new process size.
Deallocate user pages to bring the process size from oldsz to newsz . oldsz and newsz need not be page - aligned nor does newsz need to be less than oldsz . oldsz can be larger than the actual process size . Returns the new process size .
uint64
uvmdealloc(pagetable_t pagetable, pagetable_t kpagetable, uint64 oldsz, uint64 newsz)
{
  if(newsz >= oldsz)
    return oldsz;
  if(PGROUNDUP(newsz) < PGROUNDUP(oldsz)){
    int npages = (PGROUNDUP(oldsz) - PGROUNDUP(newsz)) / PGSIZE;
    vmunmap(kpagetable, PGROUNDUP(newsz), npages, 0);
    vmunmap(pagetable, PGROUNDUP(newsz), npages, 1);
  }
  return newsz;
}
uint64 uvmdealloc ( pagetable_t pagetable , pagetable_t kpagetable , uint64 oldsz , uint64 newsz ) { if ( newsz >= oldsz ) return oldsz ; if ( PGROUNDUP ( newsz ) < PGROUNDUP ( oldsz ) ) { int npages = ( PGROUNDUP ( oldsz ) - PGROUNDUP ( newsz ) ) / PGSIZE ; vmunmap ( kpagetable , PGROUNDUP ( newsz ) , npages , 0 ) ; vmunmap ( pagetable , PGROUNDUP ( newsz ) , npages , 1 ) ; } return newsz ; }
Deallocate user pages to bring the process size from oldsz to
newsz.
Deallocate user pages to bring the process size from oldsz to newsz .