diff options
author | Vratko Polak <vrpolak@cisco.com> | 2024-02-06 12:45:59 +0100 |
---|---|---|
committer | Damjan Marion <dmarion@0xa5.net> | 2024-02-12 16:20:31 +0000 |
commit | 04fd51c03c428859bae949a8294ee0f9c062a44b (patch) | |
tree | dbc79b343ff7797e15fbc85e5da341e9daa6918e /src/vlib/buffer.c | |
parent | 728606591135982f4677e51f668e18bd1a3873bb (diff) |
buffers: bring back cache occupancy improvement
The improvement was removed in 40129,
causing 5-40% regressions in AVF tests.
There is a memory-speed trade-off,
this change prefers speed over memory efficiency.
Ideally, the choice should be configurable,
but that is not easy to achieve, considering
how early is vlib_buffer_main_init called.
Type: fix
Fixes: 038dad7ef29b0b724071edb5f8cc7a9845584454
Change-Id: I4746f3634abe6d233c9d092a372de05b3d1ae4b6
Signed-off-by: Vratko Polak <vrpolak@cisco.com>
Diffstat (limited to 'src/vlib/buffer.c')
-rw-r--r-- | src/vlib/buffer.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/vlib/buffer.c b/src/vlib/buffer.c index 82fe6412781..b5200ba5029 100644 --- a/src/vlib/buffer.c +++ b/src/vlib/buffer.c @@ -473,6 +473,10 @@ vlib_buffer_alloc_size (uword ext_hdr_size, uword data_size) uword alloc_size = ext_hdr_size + sizeof (vlib_buffer_t) + data_size; alloc_size = round_pow2 (alloc_size, VLIB_BUFFER_ALIGN); + /* in case when we have even number of 'cachelines', we add one more for + * better cache occupancy */ + alloc_size |= VLIB_BUFFER_ALIGN; + return alloc_size; } |