Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F107722466
D38314.id116420.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D38314.id116420.diff
View Options
diff --git a/stand/kboot/main.c b/stand/kboot/main.c
--- a/stand/kboot/main.c
+++ b/stand/kboot/main.c
@@ -322,6 +322,7 @@
{
int i = 0;
const size_t segsize = 64*1024*1024;
+ size_t sz;
if (nkexec_segments == HOST_KEXEC_SEGMENT_MAX)
panic("Tried to load too many kexec segments");
@@ -332,10 +333,22 @@
goto out;
}
- loaded_segments[nkexec_segments].buf = host_getmem(segsize);
- loaded_segments[nkexec_segments].bufsz = segsize;
+ sz = segsize;
+ if (nkexec_segments == 0) {
+ /* 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));
+ /* And only use 95% of what we can allocate */
+ sz = min(sz, rounddown2(
+ (commit_limit - committed_as) * 95 / 100, SEGALIGN));
+ printf("Allocating %zd MB for first segment\n", sz >> 20);
+ }
+
+ loaded_segments[nkexec_segments].buf = host_getmem(sz);
+ loaded_segments[nkexec_segments].bufsz = sz;
loaded_segments[nkexec_segments].mem = (void *)rounddown2(dest,SEGALIGN);
- loaded_segments[nkexec_segments].memsz = segsize;
+ loaded_segments[nkexec_segments].memsz = sz;
i = nkexec_segments;
nkexec_segments++;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Jan 18, 7:22 PM (6 h, 54 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15864220
Default Alt Text
D38314.id116420.diff (1 KB)
Attached To
Mode
D38314: kboot: Allocate a really big first segment
Attached
Detach File
Event Timeline
Log In to Comment