mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-04-19 21:45:33 +00:00
DEBUG: fd: add name hint for large memory areas
Thanks to ("MINOR: tools: add vma_set_name() helper"), set a name hint for large arrays created by fd api (fdtab arrays and so on) so that that they can be easily identified in /proc/<pid>/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/<pid>/maps: 7b8e83200000-7b8e84201000 rw-p 00000000 00:00 0 [anon:fd:fdinfo] 7b8e84400000-7b8e85401000 rw-p 00000000 00:00 0 [anon:fd:polled_mask] 7b8e85600000-7b8e89601000 rw-p 00000000 00:00 0 [anon:fd:fdtab_addr] 7b8e90a00000-7b8e90e01000 rw-p 00000000 00:00 0 [anon:fd:fd_updt]
This commit is contained in:
parent
9424e5a06f
commit
22ec2ad8b0
4
src/fd.c
4
src/fd.c
@ -1108,6 +1108,7 @@ void poller_pipe_io_handler(int fd)
|
|||||||
static int alloc_pollers_per_thread()
|
static int alloc_pollers_per_thread()
|
||||||
{
|
{
|
||||||
fd_updt = calloc(global.maxsock, sizeof(*fd_updt));
|
fd_updt = calloc(global.maxsock, sizeof(*fd_updt));
|
||||||
|
vma_set_name(fd_updt, global.maxsock * sizeof(*fd_updt), "fd", "fd_updt");
|
||||||
return fd_updt != NULL;
|
return fd_updt != NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1162,6 +1163,7 @@ int init_pollers()
|
|||||||
ha_alert("Not enough memory to allocate %d entries for fdtab!\n", global.maxsock);
|
ha_alert("Not enough memory to allocate %d entries for fdtab!\n", global.maxsock);
|
||||||
goto fail_tab;
|
goto fail_tab;
|
||||||
}
|
}
|
||||||
|
vma_set_name(fdtab_addr, global.maxsock * sizeof(*fdtab) + 64, "fd", "fdtab_addr");
|
||||||
|
|
||||||
/* always provide an aligned fdtab */
|
/* always provide an aligned fdtab */
|
||||||
fdtab = (struct fdtab*)((((size_t)fdtab_addr) + 63) & -(size_t)64);
|
fdtab = (struct fdtab*)((((size_t)fdtab_addr) + 63) & -(size_t)64);
|
||||||
@ -1170,11 +1172,13 @@ int init_pollers()
|
|||||||
ha_alert("Not enough memory to allocate %d entries for polled_mask!\n", global.maxsock);
|
ha_alert("Not enough memory to allocate %d entries for polled_mask!\n", global.maxsock);
|
||||||
goto fail_polledmask;
|
goto fail_polledmask;
|
||||||
}
|
}
|
||||||
|
vma_set_name(polled_mask, global.maxsock * sizeof(*polled_mask), "fd", "polled_mask");
|
||||||
|
|
||||||
if ((fdinfo = calloc(global.maxsock, sizeof(*fdinfo))) == NULL) {
|
if ((fdinfo = calloc(global.maxsock, sizeof(*fdinfo))) == NULL) {
|
||||||
ha_alert("Not enough memory to allocate %d entries for fdinfo!\n", global.maxsock);
|
ha_alert("Not enough memory to allocate %d entries for fdinfo!\n", global.maxsock);
|
||||||
goto fail_info;
|
goto fail_info;
|
||||||
}
|
}
|
||||||
|
vma_set_name(fdinfo, global.maxsock * sizeof(*fdinfo), "fd", "fdinfo");
|
||||||
|
|
||||||
for (p = 0; p < MAX_TGROUPS; p++)
|
for (p = 0; p < MAX_TGROUPS; p++)
|
||||||
update_list[p].first = update_list[p].last = -1;
|
update_list[p].first = update_list[p].last = -1;
|
||||||
|
Loading…
Reference in New Issue
Block a user