0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-09-16 18:35:19 +00:00
Commit Graph

28 Commits

Author SHA1 Message Date
Maria Matejka
170b20701c Converted Slab allocator to typed lists 2022-04-06 18:14:08 +02:00
Maria Matejka
ebd807c0b8 Slab allocator can free the blocks without knowing the parent structure 2022-04-06 18:14:08 +02:00
Maria Matejka
3c42f7af6a Slab memory allocator unit test 2022-03-14 17:37:56 +01:00
Maria Matejka
c78247f9b9 Single-threaded version of sark-branch memory page management 2022-03-09 09:10:44 +01:00
Maria Matejka
d071aca7aa Merge commit '2c13759136951ef0e70a3e3c2b2d3c9a387f7ed9' into haugesund 2022-03-02 10:01:44 +01:00
Ondrej Zajicek (work)
edc1a24017 Lib: Update alignment of slabs
Alignment of slabs should be at least sizeof(ptr) to avoid unaligned
pointers in slab structures. Fixme: Use proper way to choose alignment
for internal allocators.
2022-02-07 04:39:49 +01:00
Maria Matejka
f772afc525 Memory statistics split into Effective and Overhead
This feature is intended mostly for checking that BIRD's allocation
strategies don't consume much memory space. There are some cases where
withdrawing routes in a specific order lead to memory fragmentation and
this output should give the user at least a notion of how much memory is
actually used for data storage and how much memory is "just allocated"
or used for overhead.

Also raising the "system allocator overhead estimation" from 8 to 16
bytes; it is probably even more. I've found 16 as a local minimum in
best scenarios among reachable machines. I couldn't find any reasonable
method to estimate this value when BIRD starts up.

This commit also fixes the inaccurate computation of memory overhead for
slabs where the "system allocater overhead estimation" was improperly
added to the size of mmap-ed memory.
2021-11-27 22:54:15 +01:00
Maria Matejka
923a6644b2 Fixed memory poisoning in slab 2021-09-10 17:38:22 +02:00
Maria Matejka
886dd92eee Slab: head now uses bitmask for used/free nodes info instead of lists
From now, there are no auxiliary pointers stored in the free slab nodes.
This led to strange debugging problems if use-after-free happened in
slab-allocated structures, especially if the structure's first member is
a next pointer.

This also reduces the memory needed by 1 pointer per allocated object.
OTOH, we now rely on pages being aligned to their size's multiple, which
is quite common anyway.
2021-03-25 16:47:48 +01:00
Toke Høiland-Jørgensen
db2d29073a lib/slab: introduce sl_allocz() function and use it in Babel
The babel protocol code was initialising objects returned from the slab
allocator by assigning to each of the struct members individually, but
wasn't touching the NODE member while doing so. This leads to warnings on
debug builds since commit:

baac700906 ("List expensive check.")

To fix this, introduce an sl_allocz() variant of the slab allocator which
will zero out the memory before returning it, and switch all the babel call
sites to use this version. The overhead for doing this should be negligible
for small objects, and in the case of babel, the largest object being
allocated was being zeroed anyway, so we can drop the memset in
babel_read_tlv().
2020-11-24 02:36:31 +01:00
Maria Matejka
59238768b3 Slab: Init node in slab head to NULLs. 2020-05-01 15:19:12 +02:00
Pavel Tvrdík
ae80a2de95 unsigned [int] -> uint 2015-06-08 02:24:08 +02:00
Ondrej Zajicek
20e8d040b0 Fixes integer overflow in show memory command.
Thanks to Job Snijders for the bugreport.
2014-06-30 11:55:22 +02:00
Ondrej Zajicek
a03ede6493 Fixes a tricky bug in route filtering.
Route attributes was used after rta was freed during copy-on-write in
filter code. This causes some random crashes, esp. with multipath
routes.
2012-01-03 00:42:25 +01:00
Ondrej Zajicek
acb60628f5 Implements command that shows memory usage. 2010-06-02 22:20:40 +02:00
Ondrej Zajicek
46eb80d5d5 Fixes headers for uintptr_t (and build on NetBSD). 2009-09-17 17:52:36 +02:00
Ondrej Zajicek
d1abbeacfb Fixes memory alignment problems on Sparc64.
Not quite standard construction, i should add
some autoconf macro.

Not tested yet.
2009-07-06 19:07:01 +02:00
Martin Mares
9831e5916f Staticized lots of local functions. 2004-06-05 09:58:23 +00:00
Martin Mares
58f7d004fd Fixes to the progdoc. 2000-06-07 13:25:53 +00:00
Martin Mares
5cc1e1f805 Documented memory resources. 2000-06-05 11:41:41 +00:00
Martin Mares
be77b6890c Poisoning: take there... 2000-05-16 15:02:33 +00:00
Martin Mares
e2f4f27564 Oops, the poison was too deadly... 2000-05-16 13:53:44 +00:00
Martin Mares
b8e60d3562 Added poisoning of free'd objects when we're debugging. 2000-05-16 13:51:31 +00:00
Martin Mares
c976342828 Implemented debugging function rlookup() which you can call from gdb
to see what resource does the address given as a parameter belong to.
2000-05-08 22:33:38 +00:00
Martin Mares
221135d6bf Include "lib/string.h" instead of <string.h>. It should give us bzero()
and other non-portable functions on all systems.
2000-03-31 23:30:21 +00:00
Martin Mares
3549667925 Implemented real slab allocator. If you suspect it from being buggy,
just #define FAKE_SLAB at the top of lib/slab.c to bypass it.
2000-03-05 22:48:30 +00:00
Martin Mares
d4bc8dc000 Staticized some variables and functions. 1998-05-24 14:46:20 +00:00
Martin Mares
18c8241a91 BIRD library: The story continues.
Complete resource manages and IP address handling.
1998-05-03 16:43:39 +00:00