fs/shm: align memory size to cache line size
Make sure the share memory takes the full cache line. Signed-off-by: Neo Xu <neo.xu1990@gmail.com>
This commit is contained in:
parent
9af5fc5d09
commit
8a70377fc4
|
@ -28,6 +28,7 @@
|
|||
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/cache.h>
|
||||
#include <nuttx/nuttx.h>
|
||||
#include <nuttx/kmalloc.h>
|
||||
#include <nuttx/pgalloc.h>
|
||||
|
||||
|
@ -54,7 +55,8 @@ FAR struct shmfs_object_s *shmfs_alloc_object(size_t length)
|
|||
size_t cachesize = up_get_dcache_linesize();
|
||||
if (cachesize > 0)
|
||||
{
|
||||
object->paddr = fs_heap_memalign(cachesize, length);
|
||||
object->paddr = fs_heap_memalign(cachesize,
|
||||
ALIGN_UP(length, cachesize));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -78,7 +80,8 @@ FAR struct shmfs_object_s *shmfs_alloc_object(size_t length)
|
|||
size_t cachesize = up_get_dcache_linesize();
|
||||
if (cachesize > 0)
|
||||
{
|
||||
object->paddr = kumm_memalign(cachesize, length);
|
||||
object->paddr = kumm_memalign(cachesize,
|
||||
ALIGN_UP(length, cachesize));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue