Changeset View
Changeset View
Standalone View
Standalone View
sys/kern/vfs_bio.c
Show First 20 Lines • Show All 43 Lines • ▼ Show 20 Lines | |||||
* see man buf(9) for more info. | * see man buf(9) for more info. | ||||
*/ | */ | ||||
#include <sys/cdefs.h> | #include <sys/cdefs.h> | ||||
__FBSDID("$FreeBSD$"); | __FBSDID("$FreeBSD$"); | ||||
#include <sys/param.h> | #include <sys/param.h> | ||||
#include <sys/systm.h> | #include <sys/systm.h> | ||||
#include <sys/asan.h> | |||||
#include <sys/bio.h> | #include <sys/bio.h> | ||||
#include <sys/bitset.h> | #include <sys/bitset.h> | ||||
#include <sys/conf.h> | #include <sys/conf.h> | ||||
#include <sys/counter.h> | #include <sys/counter.h> | ||||
#include <sys/buf.h> | #include <sys/buf.h> | ||||
#include <sys/devicestat.h> | #include <sys/devicestat.h> | ||||
#include <sys/eventhandler.h> | #include <sys/eventhandler.h> | ||||
#include <sys/fail.h> | #include <sys/fail.h> | ||||
▲ Show 20 Lines • Show All 977 Lines • ▼ Show 20 Lines | |||||
* may be called more then once. We CANNOT write to the memory area | * may be called more then once. We CANNOT write to the memory area | ||||
* 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 | |||||
* when sizing maps based on the amount of physical memory available. | |||||
*/ | |||||
physmem_est = (physmem_est * KASAN_SHADOW_SCALE) / | |||||
(KASAN_SHADOW_SCALE + 1); | |||||
#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); | ||||
maxbcachebuf_adjust(); | maxbcachebuf_adjust(); | ||||
▲ Show 20 Lines • Show All 4,478 Lines • Show Last 20 Lines |