Skip to content

Commit 92ce22e

Browse files
Add osif_malloc increment counters
1 parent d81869b commit 92ce22e

File tree

2 files changed

+23
-9
lines changed

2 files changed

+23
-9
lines changed

module/os/windows/spl/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ wdk_add_library(splkern
3838
spl-windows.c
3939
spl-xdr.c
4040
spl-lookasidelist.c
41+
${TMH_FILE_LIST}
4142
)
4243

4344
target_include_directories(splkern BEFORE PUBLIC "${CMAKE_SOURCE_DIR}/include/os/windows/" PUBLIC "${CMAKE_SOURCE_DIR}/include/os/windows/spl")

module/os/windows/spl/spl-lookasidelist.c

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,15 @@ static lookasidelist_stats_t lookasidelist_stats = {
2424
{ "chunk_size", KSTAT_DATA_UINT64 },
2525
};
2626

27+
#ifdef _KERNEL
28+
extern uint64_t stat_osif_malloc_success;
29+
extern uint64_t stat_osif_free;
30+
extern uint64_t stat_osif_malloc_bytes;
31+
extern uint64_t stat_osif_free_bytes;
32+
extern uint64_t segkmem_total_mem_allocated;
33+
#endif
34+
35+
2736
static int
2837
lookaside_kstat_update(kstat_t *ksp, int rw)
2938
{
@@ -153,20 +162,24 @@ lookasidelist_cache_destroy(lookasidelist_cache_t *pLookasidelist_cache)
153162

154163
void *
155164
lookasidelist_cache_alloc(lookasidelist_cache_t *pLookasidelist_cache)
156-
{
157-
void *buf = ExAllocateFromLookasideListEx(
165+
{
166+
void* buf = ExAllocateFromLookasideListEx(
158167
&pLookasidelist_cache->lookasideField);
159168

160-
if (buf == NULL)
161-
{
162-
buf = ExAllocatePoolWithTagPriority(NonPagedPoolNx, pLookasidelist_cache->cache_chunksize, '!SFZ', HighPoolPriority);
169+
if (buf == NULL) {
170+
171+
buf = ExAllocatePoolWithTagPriority(NonPagedPoolNx, pLookasidelist_cache->cache_chunksize, ZFS_LookAsideList_DRV_TAG, HighPoolPriority);
163172
if (buf != NULL)
164173
{
165-
atomic_inc_64(pLookasidelist_cache->cache_active_allocations);
166-
atomic_inc_64(pLookasidelist_cache->total_alloc);
167-
}
168-
}
174+
atomic_inc_64(&stat_osif_malloc_success);
175+
atomic_add_64(&segkmem_total_mem_allocated, pLookasidelist_cache->cache_chunksize);
176+
atomic_add_64(&stat_osif_malloc_bytes, pLookasidelist_cache->cache_chunksize);
169177

178+
atomic_inc_64(&pLookasidelist_cache->cache_active_allocations);
179+
atomic_inc_64(&pLookasidelist_cache->total_alloc);
180+
}
181+
}
182+
170183
ASSERT(buf != NULL);
171184
return (buf);
172185
}

0 commit comments

Comments
 (0)