mm/shm: Convert bytes to pages by MM_NPAGES instead of MM_PGALIGNUP
This commit is contained in:
parent
b507fe9606
commit
b5e2754d2d
@ -153,7 +153,7 @@ FAR void *shmat(int shmid, FAR const void *shmaddr, int shmflg)
|
|||||||
|
|
||||||
/* Convert the region size to pages */
|
/* Convert the region size to pages */
|
||||||
|
|
||||||
npages = MM_PGALIGNUP(region->sr_ds.shm_segsz);
|
npages = MM_NPAGES(region->sr_ds.shm_segsz);
|
||||||
|
|
||||||
/* Attach, i.e, map, on shared memory region to the user virtual address. */
|
/* Attach, i.e, map, on shared memory region to the user virtual address. */
|
||||||
|
|
||||||
|
@ -132,7 +132,7 @@ int shmdt(FAR const void *shmaddr)
|
|||||||
|
|
||||||
/* Convert the region size to pages */
|
/* Convert the region size to pages */
|
||||||
|
|
||||||
npages = MM_PGALIGNUP(region->sr_ds.shm_segsz);
|
npages = MM_NPAGES(region->sr_ds.shm_segsz);
|
||||||
|
|
||||||
/* Detach, i.e, unmap, on shared memory region from a user virtual
|
/* Detach, i.e, unmap, on shared memory region from a user virtual
|
||||||
* address.
|
* address.
|
||||||
|
@ -173,11 +173,11 @@ static int shm_extend(int shmid, size_t size)
|
|||||||
|
|
||||||
/* This is the number of pages that are needed to satisfy the allocation */
|
/* This is the number of pages that are needed to satisfy the allocation */
|
||||||
|
|
||||||
pgneeded = MM_PGALIGNUP(size);
|
pgneeded = MM_NPAGES(size);
|
||||||
|
|
||||||
/* This is the number of pages that have already been allocated */
|
/* This is the number of pages that have already been allocated */
|
||||||
|
|
||||||
pgalloc = MM_PGALIGNUP(region->sr_ds.shm_segsz);
|
pgalloc = MM_NPAGES(region->sr_ds.shm_segsz);
|
||||||
|
|
||||||
/* Loop until all pages have been allocated (or something bad happens) */
|
/* Loop until all pages have been allocated (or something bad happens) */
|
||||||
|
|
||||||
@ -192,7 +192,7 @@ static int shm_extend(int shmid, size_t size)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Increment the number of pages successully allocated */
|
/* Increment the number of pages successfully allocated */
|
||||||
|
|
||||||
pgalloc++;
|
pgalloc++;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user