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
This commit is contained in:
parent
3a616b10d8
commit
35b4acad2f
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user