Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 01 Mar 2013 15:50:28 +0200
From:      Andriy Gapon <avg@FreeBSD.org>
To:        freebsd-hackers <freebsd-hackers@FreeBSD.org>
Subject:   memory allocation in spinlock context
Message-ID:  <5130B224.8000600@FreeBSD.org>

next in thread | raw e-mail | index | archive | help

I am trying to understand if it is possible to allow memory allocations (M_NOWAIT,
of course) in a spinlock context.
I do not see any obvious architectural obstacles.
But the fact that all of the uma locks, system map lock, object locks, page queue
locks and so on are regular mutexes makes it impossible to allocate memory without
violating the fundamental lock ordering rules.

Could all of the above mentioned locks potentially be converted to spin mutexes?
(And that seems to be a large nasty change)
Are there any alternative possibilities?

BTW, currently we have at least one place where a memory allocation of this kind
is done stealthily (and thus dangerously?).  ACPI resume code must execute
AcpiLeaveSleepStatePrep with interrupts disabled and ACPICA code performs memory
allocations in that code path.  Since the interrupts are disabled by means of
intr_disable(), witness(9) and similar are completely oblivious of the fact.

-- 
Andriy Gapon



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?5130B224.8000600>