From 87da7c794c9bc8e311ae5242820fbf8aefd8d558 Mon Sep 17 00:00:00 2001 From: Far Date: Wed, 28 Apr 2021 14:31:31 +0800 Subject: [PATCH] fix: PathCacheMemoryDump miscalculate the RAM usage of PathCache PathCacheMemoryDump miscalculate the RAM usage of PathCache for not counting the name field of PathCache, which is allocated with PathCache Close #I3OBXY --- fs/vfs/path_cache.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fs/vfs/path_cache.c b/fs/vfs/path_cache.c index b60975ed..2d607e2c 100644 --- a/fs/vfs/path_cache.c +++ b/fs/vfs/path_cache.c @@ -64,16 +64,18 @@ void PathCacheDump(void) void PathCacheMemoryDump(void) { int pathCacheNum = 0; + int nameSum = 0; for (int i = 0; i < LOSCFG_MAX_PATH_CACHE_SIZE; i++) { LIST_HEAD *dhead = &g_pathCacheHashEntrys[i]; struct PathCache *dent = NULL; LOS_DL_LIST_FOR_EACH_ENTRY(dent, dhead, struct PathCache, hashEntry) { pathCacheNum++; + nameSum += dent->nameLen; } } PRINTK("pathCache number = %d\n", pathCacheNum); - PRINTK("pathCache memory size = %d(B)\n", pathCacheNum * sizeof(struct PathCache)); + PRINTK("pathCache memory size = %d(B)\n", pathCacheNum * sizeof(struct PathCache) + nameSum); } static uint32_t NameHash(const char *name, int len, struct Vnode *dvp)