From 6c5869f8461a0be2b4839690f446a3aaa6e34006 Mon Sep 17 00:00:00 2001 From: Aurelien DARRAGON Date: Mon, 20 May 2024 15:16:10 +0200 Subject: [PATCH] DEBUG: sink: add name hint for memory area used by memory-backed sinks Thanks to ("MINOR: tools: add vma_set_name() helper"), set a name hint for user created memory-backed sinks (ring sections without backing-file) so that they can be easily indentified in /proc//maps. Depending on malloc() implementation, such memory areas will normally be merged on the heap under MMAP_THRESHOLD (128 kB by default) and will have a dedicated memory area once the threshold is exceeded. As such, when large enough, they will appear like this in /proc//maps: 7b8e8ac00000-7b8e8bf13000 rw-p 00000000 00:00 0 [anon:ring:myring] --- src/sink.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/sink.c b/src/sink.c index 279a0eb95..1a9165e7c 100644 --- a/src/sink.c +++ b/src/sink.c @@ -829,6 +829,12 @@ static int sink_finalize(struct sink *sink) ha_alert("error when trying to initialize sink buffer forwarding.\n"); err_code |= ERR_ALERT | ERR_FATAL; } + if (!sink->store) { + /* virtual memory backed sink */ + vma_set_name(ring_allocated_area(sink->ctx.ring), + ring_allocated_size(sink->ctx.ring), + "ring", sink->name); + } } return err_code; }