Jan Dabros has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/43512 )
Change subject: lib/bootmem.c: Improve bootmem_allocate_buffer algorithm ......................................................................
lib/bootmem.c: Improve bootmem_allocate_buffer algorithm
Since regions in bootmem are sorted by increasing base address, we may boil out of the search loop as soon as the region_base is bigger than the max address allowed.
Signed-off-by: Jan Dabros jsd@semihalf.com Change-Id: I44b44bf9618fd0615103cbf74271235d61d49473 --- M src/lib/bootmem.c 1 file changed, 3 insertions(+), 3 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/12/43512/1
diff --git a/src/lib/bootmem.c b/src/lib/bootmem.c index fa1f8bc..1fe23c2 100644 --- a/src/lib/bootmem.c +++ b/src/lib/bootmem.c @@ -231,15 +231,15 @@ size = ALIGN(size, 4096); region = NULL; memranges_each_entry(r, &bootmem) { + if (range_entry_base(r) >= max_addr) + break; + if (range_entry_size(r) < size) continue;
if (range_entry_tag(r) != BM_MEM_RAM) continue;
- if (range_entry_base(r) >= max_addr) - continue; - end = range_entry_end(r); if (end > max_addr) end = max_addr;
Paul Fagerburg has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/43512 )
Change subject: lib/bootmem.c: Improve bootmem_allocate_buffer algorithm ......................................................................
Patch Set 1: Code-Review+1
Julius Werner has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/43512 )
Change subject: lib/bootmem.c: Improve bootmem_allocate_buffer algorithm ......................................................................
Patch Set 2: Code-Review+2
(1 comment)
https://review.coreboot.org/c/coreboot/+/43512/2//COMMIT_MSG Commit Message:
https://review.coreboot.org/c/coreboot/+/43512/2//COMMIT_MSG@10 PS2, Line 10: boil nit: bail?
Angel Pons has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/43512 )
Change subject: lib/bootmem.c: Improve bootmem_allocate_buffer algorithm ......................................................................
Patch Set 2:
(1 comment)
https://review.coreboot.org/c/coreboot/+/43512/2//COMMIT_MSG Commit Message:
https://review.coreboot.org/c/coreboot/+/43512/2//COMMIT_MSG@10 PS2, Line 10: boil
nit: bail?
Probably. This can be easily corrected from within Gerrit
Hello build bot (Jenkins), Patrick Georgi, Martin Roth, Paul Menzel, Paul Fagerburg, Julius Werner,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/43512
to look at the new patch set (#3).
Change subject: lib/bootmem.c: Improve bootmem_allocate_buffer algorithm ......................................................................
lib/bootmem.c: Improve bootmem_allocate_buffer algorithm
Since regions in bootmem are sorted by increasing base address, we may bail out of the search loop as soon as the region_base is bigger than the max address allowed.
Signed-off-by: Jan Dabros jsd@semihalf.com Change-Id: I44b44bf9618fd0615103cbf74271235d61d49473 --- M src/lib/bootmem.c 1 file changed, 3 insertions(+), 3 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/12/43512/3
Jan Dabros has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/43512 )
Change subject: lib/bootmem.c: Improve bootmem_allocate_buffer algorithm ......................................................................
Patch Set 3:
(1 comment)
https://review.coreboot.org/c/coreboot/+/43512/2//COMMIT_MSG Commit Message:
https://review.coreboot.org/c/coreboot/+/43512/2//COMMIT_MSG@10 PS2, Line 10: boil
Probably. […]
Done directly from Gerrit GUI.
Angel Pons has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/43512 )
Change subject: lib/bootmem.c: Improve bootmem_allocate_buffer algorithm ......................................................................
Patch Set 3: Code-Review+2
Paul Fagerburg has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/43512 )
Change subject: lib/bootmem.c: Improve bootmem_allocate_buffer algorithm ......................................................................
Patch Set 3: Code-Review+2
Angel Pons has submitted this change. ( https://review.coreboot.org/c/coreboot/+/43512 )
Change subject: lib/bootmem.c: Improve bootmem_allocate_buffer algorithm ......................................................................
lib/bootmem.c: Improve bootmem_allocate_buffer algorithm
Since regions in bootmem are sorted by increasing base address, we may bail out of the search loop as soon as the region_base is bigger than the max address allowed.
Signed-off-by: Jan Dabros jsd@semihalf.com Change-Id: I44b44bf9618fd0615103cbf74271235d61d49473 Reviewed-on: https://review.coreboot.org/c/coreboot/+/43512 Reviewed-by: Angel Pons th3fanbus@gmail.com Reviewed-by: Paul Fagerburg pfagerburg@chromium.org Reviewed-by: Julius Werner jwerner@chromium.org Tested-by: build bot (Jenkins) no-reply@coreboot.org --- M src/lib/bootmem.c 1 file changed, 3 insertions(+), 3 deletions(-)
Approvals: build bot (Jenkins): Verified Julius Werner: Looks good to me, approved Angel Pons: Looks good to me, approved Paul Fagerburg: Looks good to me, approved
diff --git a/src/lib/bootmem.c b/src/lib/bootmem.c index fa1f8bc..1fe23c2 100644 --- a/src/lib/bootmem.c +++ b/src/lib/bootmem.c @@ -231,15 +231,15 @@ size = ALIGN(size, 4096); region = NULL; memranges_each_entry(r, &bootmem) { + if (range_entry_base(r) >= max_addr) + break; + if (range_entry_size(r) < size) continue;
if (range_entry_tag(r) != BM_MEM_RAM) continue;
- if (range_entry_base(r) >= max_addr) - continue; - end = range_entry_end(r); if (end > max_addr) end = max_addr;