hwpmc: partially depessimize mmap handling if the module is not loaded
In particular this means the pmc sx lock is no longer taken when an executable mapping succeeds. MFC after: 1 week
This commit is contained in:
parent
01d1547cc2
commit
28a3fa8526
@ -2460,10 +2460,12 @@ vn_mmap(struct file *fp, vm_map_t map, vm_offset_t *addr, vm_size_t size,
|
||||
}
|
||||
#ifdef HWPMC_HOOKS
|
||||
/* Inform hwpmc(4) if an executable is being mapped. */
|
||||
if (error == 0 && (prot & VM_PROT_EXECUTE) != 0) {
|
||||
pkm.pm_file = vp;
|
||||
pkm.pm_address = (uintptr_t) *addr;
|
||||
PMC_CALL_HOOK(td, PMC_FN_MMAP, (void *) &pkm);
|
||||
if (PMC_HOOK_INSTALLED(PMC_FN_MMAP)) {
|
||||
if ((prot & VM_PROT_EXECUTE) != 0 && error == 0) {
|
||||
pkm.pm_file = vp;
|
||||
pkm.pm_address = (uintptr_t) *addr;
|
||||
PMC_CALL_HOOK(td, PMC_FN_MMAP, (void *) &pkm);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return (error);
|
||||
|
Loading…
Reference in New Issue
Block a user