Changeset View
Changeset View
Standalone View
Standalone View
sys/kern/vfs_bio.c
Show First 20 Lines • Show All 1,039 Lines • ▼ Show 20 Lines | |||||
* being reserved at this time. | * being reserved at this time. | ||||
*/ | */ | ||||
caddr_t | caddr_t | ||||
kern_vfs_bio_buffer_alloc(caddr_t v, long physmem_est) | kern_vfs_bio_buffer_alloc(caddr_t v, long physmem_est) | ||||
{ | { | ||||
int tuned_nbuf; | int tuned_nbuf; | ||||
long maxbuf, maxbuf_sz, buf_sz, biotmap_sz; | long maxbuf, maxbuf_sz, buf_sz, biotmap_sz; | ||||
#ifdef KASAN | |||||
/* | /* | ||||
* With KASAN enabled, the kernel map is shadowed. Account for this | * With KASAN or KMSAN enabled, the kernel map is shadowed. Account for | ||||
* when sizing maps based on the amount of physical memory available. | * this when sizing maps based on the amount of physical memory | ||||
* available. | |||||
*/ | */ | ||||
#if defined(KASAN) | |||||
physmem_est = (physmem_est * KASAN_SHADOW_SCALE) / | physmem_est = (physmem_est * KASAN_SHADOW_SCALE) / | ||||
(KASAN_SHADOW_SCALE + 1); | (KASAN_SHADOW_SCALE + 1); | ||||
#elif defined(KMSAN) | |||||
physmem_est /= 3; | |||||
#endif | #endif | ||||
/* | /* | ||||
* physmem_est is in pages. Convert it to kilobytes (assumes | * physmem_est is in pages. Convert it to kilobytes (assumes | ||||
* PAGE_SIZE is >= 1K) | * PAGE_SIZE is >= 1K) | ||||
*/ | */ | ||||
physmem_est = physmem_est * (PAGE_SIZE / 1024); | physmem_est = physmem_est * (PAGE_SIZE / 1024); | ||||
▲ Show 20 Lines • Show All 4,481 Lines • Show Last 20 Lines |