mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-15 10:17:20 +00:00
In uma_zalloc_arg(), if we are performing a M_WAITOK allocation, ensure
that td_intr_nesting_level is 0 (like malloc() does). Since malloc() calls uma we can probably remove the check in malloc() for this now. Also, perform an extra witness check in that case to make sure we don't hold any locks when performing a M_WAITOK allocation.
This commit is contained in:
parent
bbd296aba6
commit
4c1cc01cd8
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=97007
@ -66,6 +66,7 @@
|
||||
#include <sys/lock.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <sys/mutex.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/smp.h>
|
||||
#include <sys/vmmeter.h>
|
||||
|
||||
@ -1317,6 +1318,12 @@ uma_zalloc_arg(uma_zone_t zone, void *udata, int flags)
|
||||
printf("Allocating one item from %s(%p)\n", zone->uz_name, zone);
|
||||
#endif
|
||||
|
||||
if (!(flags & M_NOWAIT)) {
|
||||
KASSERT(curthread->td_intr_nesting_level == 0,
|
||||
("malloc(M_WAITOK) in interrupt context"));
|
||||
WITNESS_SLEEP(1, NULL);
|
||||
}
|
||||
|
||||
zalloc_restart:
|
||||
cpu = PCPU_GET(cpuid);
|
||||
CPU_LOCK(zone, cpu);
|
||||
|
Loading…
Reference in New Issue
Block a user