Skip to content

Commit

Permalink
mm/mempool: Remove nexpend and totalsize from mempool_s
Browse files Browse the repository at this point in the history
forget in the commit(apache#9052):
commit 781a34d
Author: anjiahao <anjiahao@xiaomi.com>
Date:   Tue Apr 18 11:18:43 2023 +0800

    memepool:fix memory consumption double counting issue

Change-Id: Ib4f54444b0a2abeb1d781f5de5a116d8904a869b
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
  • Loading branch information
xiaoxiang781216 committed Jun 4, 2023
1 parent ee364e1 commit 9b51a9b
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 13 deletions.
2 changes: 0 additions & 2 deletions include/nuttx/mm/mempool.h
Expand Up @@ -109,8 +109,6 @@ struct mempool_s
#endif
spinlock_t lock; /* The protect lock to mempool */
sem_t waitsem; /* The semaphore of waiter get free block */
size_t nexpend; /* The number of expend memory for mempool */
size_t totalsize; /* Total size of the expend for mempoll */
#if defined(CONFIG_FS_PROCFS) && !defined(CONFIG_FS_PROCFS_EXCLUDE_MEMPOOL)
struct mempool_procfs_entry_s procfs; /* The entry of procfs */
#endif
Expand Down
8 changes: 0 additions & 8 deletions mm/mempool/mempool.c
Expand Up @@ -136,8 +136,6 @@ int mempool_init(FAR struct mempool_s *pool, FAR const char *name)
sq_init(&pool->queue);
sq_init(&pool->iqueue);
sq_init(&pool->equeue);
pool->nexpend = 0;
pool->totalsize = 0;

#if CONFIG_MM_BACKTRACE >= 0
list_initialize(&pool->alist);
Expand All @@ -157,8 +155,6 @@ int mempool_init(FAR struct mempool_s *pool, FAR const char *name)
return -ENOMEM;
}

pool->nexpend++;
pool->totalsize += size;
mempool_add_queue(&pool->iqueue, pool->ibase, ninterrupt, blocksize);
kasan_poison(pool->ibase, size);
}
Expand All @@ -184,8 +180,6 @@ int mempool_init(FAR struct mempool_s *pool, FAR const char *name)
return -ENOMEM;
}

pool->nexpend++;
pool->totalsize += size;
mempool_add_queue(&pool->queue, base, ninitial, blocksize);
sq_addlast((FAR sq_entry_t *)(base + ninitial * blocksize),
&pool->equeue);
Expand Down Expand Up @@ -259,8 +253,6 @@ FAR void *mempool_alloc(FAR struct mempool_s *pool)
return NULL;
}

pool->nexpend++;
pool->totalsize += size;
kasan_poison(base, size);
flags = spin_lock_irqsave(&pool->lock);
mempool_add_queue(&pool->queue, base, nexpand, blocksize);
Expand Down
5 changes: 2 additions & 3 deletions mm/mm_heap/mm_malloc.c
Expand Up @@ -98,8 +98,7 @@ void mm_mempool_dump_handle(FAR struct mempool_s *pool, FAR void *arg)
mempool_info(pool, &info);
mwarn("%9lu%11lu%9lu%9lu%9lu%9lu%9zu\n",
info.sizeblks, info.arena, info.aordblks,
info.ordblks, info.iordblks,
info.nwaiter, pool->nexpend);
info.ordblks, info.iordblks, info.nwaiter);
}
#endif

Expand Down Expand Up @@ -293,7 +292,7 @@ FAR void *mm_malloc(FAR struct mm_heap_s *heap, size_t size)
# endif
# if CONFIG_MM_HEAP_MEMPOOL_THRESHOLD != 0
mwarn("%11s%9s%9s%9s%9s%9s%9s\n", "bsize", "total", "nused",
"nfree", "nifree", "nwaiter", "nexpend");
"nfree", "nifree", "nwaiter");
mempool_multiple_foreach(heap->mm_mpool,
mm_mempool_dump_handle, NULL);
# endif
Expand Down

0 comments on commit 9b51a9b

Please sign in to comment.