The branch main has been updated by imp:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=35b4acad2f1f7ba87eb9e0c7276ef8eef55b4a9c

commit 35b4acad2f1f7ba87eb9e0c7276ef8eef55b4a9c
Author:     Warner Losh <[email protected]>
AuthorDate: 2023-03-02 17:56:44 +0000
Commit:     Warner Losh <[email protected]>
CommitDate: 2023-03-02 18:12:10 +0000

    kboot: Use MIN instead of min
    
    MIN works for any type, while min() is only for integers. So we were
    rounding down to 0 since that's the size of 4GB truncated to an int.
    
    Sponsored by: Netflix
---
 stand/kboot/main.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/stand/kboot/main.c b/stand/kboot/main.c
index e01507323bad..849ad46add6c 100644
--- a/stand/kboot/main.c
+++ b/stand/kboot/main.c
@@ -344,10 +344,11 @@ get_phys_buffer(vm_offset_t dest, const size_t len, void 
**buf)
                /* how much space does this segment have */
                sz = space_avail(dest);
                /* Clip to 45% of available memory (need 2 copies) */
-               sz = min(sz, rounddown2(mem_avail * 45 / 100, SEGALIGN));
+               sz = MIN(sz, rounddown2(mem_avail * 45 / 100, SEGALIGN));
+               printf("limit to 45%% of mem_avail %zd\n", sz);
                /* And only use 95% of what we can allocate */
-               sz = min(sz, rounddown2(
-                   (commit_limit - committed_as) * 95 / 100, SEGALIGN));
+               sz = MIN(sz,
+                   rounddown2((commit_limit - committed_as) * 95 / 100, 
SEGALIGN));
                printf("Allocating %zd MB for first segment\n", sz >> 20);
        }
 

Reply via email to