diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2023-03-13 15:40:16 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-03-14 20:27:43 -0400 |
commit | 615e9116b55950ff0892a63aa182627e33d0210e (patch) | |
tree | b759180d4d6d1d6bd8adc6208b5f1b7a9c7a2312 | |
parent | 91b9486edb7bdbe7ea0abd9198b280b15ff4fedb (diff) |
fixup! lib: add allocation tagging support for memory allocation profiling
-rw-r--r-- | lib/alloc_tag.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/alloc_tag.c b/lib/alloc_tag.c index 5b6b41080ed2..adf8b5da18db 100644 --- a/lib/alloc_tag.c +++ b/lib/alloc_tag.c @@ -373,8 +373,11 @@ static void alloc_tag_module_unload(struct codetag_type *cttype, struct codetag_ codetag_init_iter(&iter, cttype); for (ct = codetag_next_ct(&iter); ct; ct = codetag_next_ct(&iter)) { struct alloc_tag *tag = ct_to_alloc_tag(ct); + size_t bytes = lazy_percpu_counter_read(&tag->bytes_allocated); - lazy_percpu_counter_exit(&tag->bytes_allocated); + if (!WARN(bytes, "%s:%u module %s func:%s has %zu allocated at module unload", + ct->filename, ct->lineno, ct->modname, ct->function)) + lazy_percpu_counter_exit(&tag->bytes_allocated); } } |