diff options
| author | Denys Fedoryshchenko <denys.f@collabora.com> | 2025-11-26 16:55:09 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-11-26 16:55:09 +0200 |
| commit | d013d3ff2150ca425ff13ce69d0eab394153803a (patch) | |
| tree | b45fbd327ff6ffd7448aa32711195c9e2ec4964d | |
| parent | 224c734b8ab64694319c81625e022af623b51ba0 (diff) | |
| parent | 7f08560e6d79552107ff34628e02e6f8dcf0455f (diff) | |
| download | accel-ppp-d013d3ff2150ca425ff13ce69d0eab394153803a.tar.gz accel-ppp-d013d3ff2150ca425ff13ce69d0eab394153803a.zip | |
Merge pull request #265 from nuclearcat/fix-mempool
mempool: Fix 32-bit stats
| -rw-r--r-- | accel-pppd/cli/std_cmd.c | 5 | ||||
| -rw-r--r-- | accel-pppd/triton/mempool.c | 9 | ||||
| -rw-r--r-- | accel-pppd/triton/mempool.h | 6 | ||||
| -rw-r--r-- | accel-pppd/triton/triton.h | 4 |
4 files changed, 9 insertions, 15 deletions
diff --git a/accel-pppd/cli/std_cmd.c b/accel-pppd/cli/std_cmd.c index ace48391..c37777b1 100644 --- a/accel-pppd/cli/std_cmd.c +++ b/accel-pppd/cli/std_cmd.c @@ -5,6 +5,7 @@ #include <signal.h> #include <malloc.h> #include <arpa/inet.h> +#include <inttypes.h> #include "triton.h" #include "events.h" @@ -57,8 +58,8 @@ static int show_stat_exec(const char *cmd, char * const *fields, int fields_cnt, cli_sendv(client, "mem(rss/virt): %lu/%lu kB\r\n", vmrss * page_size_kb, vmsize * page_size_kb); #endif cli_send(client, "core:\r\n"); - cli_sendv(client, " mempool_allocated: %u\r\n", triton_stat.mempool_allocated); - cli_sendv(client, " mempool_available: %u\r\n", triton_stat.mempool_available); + cli_sendv(client, " mempool_allocated: %" PRIu64 "\r\n", triton_stat.mempool_allocated); + cli_sendv(client, " mempool_available: %" PRIu64 "\r\n", triton_stat.mempool_available); cli_sendv(client, " thread_count: %u\r\n", triton_stat.thread_count); cli_sendv(client, " thread_active: %u\r\n", triton_stat.thread_active); cli_sendv(client, " context_count: %u\r\n", triton_stat.context_count); diff --git a/accel-pppd/triton/mempool.c b/accel-pppd/triton/mempool.c index ea6d1e6d..149f09d5 100644 --- a/accel-pppd/triton/mempool.c +++ b/accel-pppd/triton/mempool.c @@ -95,7 +95,7 @@ void __export *mempool_alloc(mempool_t *pool) { struct _mempool_t *p = (struct _mempool_t *)pool; struct _item_t *it; - uint32_t size = sizeof(*it) + p->size + 8; + size_t size = sizeof(*it) + p->size + 8; spin_lock(&p->lock); if (!list_empty(&p->items)) { @@ -140,7 +140,7 @@ void __export mempool_free(void *ptr) { struct _item_t *it = container_of(ptr, typeof(*it), ptr); struct _mempool_t *p = it->owner; - uint32_t size = sizeof(*it) + it->owner->size + 8; + size_t size = sizeof(*it) + it->owner->size + 8; int need_free = 0; #ifdef MEMDEBUG @@ -220,7 +220,7 @@ static void mempool_clean(void) { struct _mempool_t *p; struct _item_t *it; - uint32_t size; + size_t size; triton_log_error("mempool: clean"); @@ -257,7 +257,7 @@ static void sigclean(int num) static int mmap_grow(void) { - int size = sysconf(_SC_PAGESIZE) * (1 << PAGE_ORDER); + size_t size = sysconf(_SC_PAGESIZE) * (1 << PAGE_ORDER); uint8_t *ptr; if (mmap_endptr) { @@ -301,4 +301,3 @@ static void __init init(void) mmap_grow(); } - diff --git a/accel-pppd/triton/mempool.h b/accel-pppd/triton/mempool.h index 9ad2c370..c4f27588 100644 --- a/accel-pppd/triton/mempool.h +++ b/accel-pppd/triton/mempool.h @@ -3,16 +3,10 @@ #include <stdint.h> -struct mempool_stat_t -{ - uint32_t allocated; - uint32_t available; -}; typedef void * mempool_t; mempool_t *mempool_create(int size); mempool_t *mempool_create2(int size); -struct mempool_stat_t mempool_get_stat(void); #ifdef MEMDEBUG #include "memdebug.h" diff --git a/accel-pppd/triton/triton.h b/accel-pppd/triton/triton.h index 79bbee1b..3ce4bcbd 100644 --- a/accel-pppd/triton/triton.h +++ b/accel-pppd/triton/triton.h @@ -55,8 +55,8 @@ struct conf_sect_t struct triton_stat_t { - unsigned int mempool_allocated; - unsigned int mempool_available; + uint64_t mempool_allocated; + uint64_t mempool_available; unsigned int thread_count; unsigned int thread_active; unsigned int context_count; |
