]> asedeno.scripts.mit.edu Git - linux.git/commit
ALSA: hda: No preallocation on x86 platforms
authorTakashi Iwai <tiwai@suse.de>
Mon, 20 Jan 2020 12:44:23 +0000 (13:44 +0100)
committerTakashi Iwai <tiwai@suse.de>
Tue, 21 Jan 2020 06:12:08 +0000 (07:12 +0100)
commitc31427d0d21e198c74d5d92082c4b8194b257f82
tree40403624458e954368f63c4f675770e4c44d6adb
parentd4cfb30fce03093ad944e0b44bd8f40bdad5330e
ALSA: hda: No preallocation on x86 platforms

Like many other drivers, HD-audio drivers also do PCM buffer
preallocation to assure the buffer pages allocated at the early boot
stage.  This step is useful for platforms that may fail to allocate
the PCM hardware buffers -- which is mostly for either large
continuous pages or with the specific DMA mask (like emu10k1).

OTOH, when a buffer is allocated as SG-buffer and the DMA mask is
either 32 or 64 bits, the allocation almost never fails unless it hits
the real OOM situation.  In such a case, we don't need the
preallocation inevitably unlike the cases above.

That said, we may drop the preallocation for HD-audio that does
allocate via SG-buffers, and the patch achieves it.

However, there is one caveat: the buffer allocation behavior depends
on CONFIG_SND_DMA_SGBUF, and it falls back to the continuous pages
when it's not set.  And, currently this SG buffer allocation is
enabled only on x86 platforms.  So, covering those fall-outs, the
patch adjusts CONFIG_SND_HDA_PREALLOC_SIZE depending on the condition,
and keeps the old behavior as-is for non-x86 platforms.

On x86, the kconfig item is no longer adjustable but always set to
zero for disabling the preallocation.  You can still enable the
preallocation via procfs interface at any time later, too.

Link: https://lore.kernel.org/r/20200120124423.11862-2-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/hda/Kconfig