-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CENNSO-1670] fix: align buffers to page boundary (#50)
Fix buffers allocation for non-hugepages case Co-authored-by: Vladimir Zhigulin <[email protected]>
- Loading branch information
Showing
2 changed files
with
45 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
From 76dc1c7e320ad74f4b13a0014d5644d83817e81d Mon Sep 17 00:00:00 2001 | ||
From: Vladimir Zhigulin <[email protected]> | ||
Date: Mon, 15 Jul 2024 22:08:26 +0200 | ||
Subject: [PATCH] fix: align buffers to page boundary | ||
|
||
Upstream just avoids allocating buffers crossing | ||
page boundary what makes an issue for 4k hugepages | ||
by using small amount of buffers memory, because | ||
most of it happens on crosspage boundary. | ||
|
||
For fix instead of just dropping crosspage buffer, | ||
we align it to next page making use of more space. | ||
--- | ||
src/vlib/buffer.c | 8 ++++++-- | ||
1 file changed, 6 insertions(+), 2 deletions(-) | ||
|
||
diff --git a/src/vlib/buffer.c b/src/vlib/buffer.c | ||
index b5200ba50..391454c6d 100644 | ||
--- a/src/vlib/buffer.c | ||
+++ b/src/vlib/buffer.c | ||
@@ -475,7 +475,7 @@ vlib_buffer_alloc_size (uword ext_hdr_size, uword data_size) | ||
|
||
/* in case when we have even number of 'cachelines', we add one more for | ||
* better cache occupancy */ | ||
- alloc_size |= VLIB_BUFFER_ALIGN; | ||
+ // alloc_size |= VLIB_BUFFER_ALIGN; | ||
|
||
return alloc_size; | ||
} | ||
@@ -571,7 +571,11 @@ vlib_buffer_pool_create (vlib_main_t *vm, u32 data_size, u32 physmem_map_index, | ||
|
||
/* skip if buffer spans across page boundary */ | ||
if (((uword) p & page_mask) != ((uword) (p + alloc_size) & page_mask)) | ||
- continue; | ||
+ { | ||
+ /* round to next page instead of just skipping buffer */ | ||
+ p = (u8*) (round_pow2((uword) p, 1 << m->log2_page_size)) - alloc_size; | ||
+ continue; | ||
+ } | ||
|
||
b = (vlib_buffer_t *) (p + bm->ext_hdr_size); | ||
b->template = bp->buffer_template; | ||
-- | ||
2.45.2 | ||
|
35 changes: 0 additions & 35 deletions
35
vpp-patches/0029-fix-allow-buffers-to-span-whole-pages.patch
This file was deleted.
Oops, something went wrong.