mirror of
https://github.com/apache/nuttx.git
synced 2026-09-23 07:14:28 +08:00
fs/shm: Add a flag FS_SHMFS_NO_ALIGN to remove SHM alignment
This can be used on small systems to save RAM if the SHM object doesn't need to be cache-aligned. Signed-off-by: Jukka Laitinen <jukka.laitinen@tii.ae>
This commit is contained in:
committed by
Alin Jerpelea
parent
b7c8430de6
commit
a3f733d387
@@ -19,4 +19,14 @@ config FS_SHMFS_VFS_PATH
|
||||
The path to where shared memory objects will exist in the VFS
|
||||
namespace.
|
||||
|
||||
config FS_SHMFS_NO_ALIGN
|
||||
bool "Skip cache-line alignment/padding of shm objects"
|
||||
default n
|
||||
---help---
|
||||
Skip cache-line alignment of the shm object metadata header and
|
||||
the object length. Saves RAM in FLAT builds where shm objects
|
||||
are never used as DMA targets and no cache maintenance is
|
||||
performed on their contents. Callers that need DMA-safe shm
|
||||
buffers must not enable this.
|
||||
|
||||
endif # FS_SHMFS
|
||||
|
||||
@@ -53,7 +53,11 @@ FAR struct shmfs_object_s *shmfs_alloc_object(size_t length)
|
||||
|
||||
size_t hdr_size = sizeof(struct shmfs_object_s);
|
||||
size_t alloc_size = length;
|
||||
#ifdef CONFIG_FS_SHMFS_NO_ALIGN
|
||||
size_t cachesize = 0;
|
||||
#else
|
||||
size_t cachesize = up_get_dcache_linesize();
|
||||
#endif
|
||||
|
||||
if (cachesize > 0)
|
||||
{
|
||||
@@ -83,7 +87,11 @@ FAR struct shmfs_object_s *shmfs_alloc_object(size_t length)
|
||||
object = fs_heap_zalloc(sizeof(struct shmfs_object_s));
|
||||
if (object)
|
||||
{
|
||||
#ifdef CONFIG_FS_SHMFS_NO_ALIGN
|
||||
size_t cachesize = 0;
|
||||
#else
|
||||
size_t cachesize = up_get_dcache_linesize();
|
||||
#endif
|
||||
|
||||
if (cachesize > 0)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user