mirror of
https://github.com/apache/nuttx.git
synced 2026-05-25 01:39:44 +08:00
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:
@@ -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
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user