Re: [PATCH] ALSA: memalloc: use __GFP_RETRY_MAYFAIL for DMA mem allocs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 23 Sep 2022 17:35:01 +0200,
Kai Vehmanen wrote:
> 
> Use __GFP_RETRY_MAYFAIL instead of __GFP__NORETRY in
> snd_dma_dev_alloc(), snd_dma_wc_alloc() and friends, to allocate pages
> for device memory. The MAYFAIL flag retains the semantics of not
> triggering the OOM killer, but lowers the risk of alloc failure.
> 
> MAYFAIL flag was added in commit dcda9b04713c3 ("mm, tree wide: replace
> __GFP_REPEAT by __GFP_RETRY_MAYFAIL with more useful semantic").
> 
> This change addresses recurring failures with SOF audio driver in test
> cases where a system suspend-resume stress test is run, combined with an
> active high memory-load use-case. The failure typically shows up as:
> 
> [ 379.480229] sof-audio-pci-intel-tgl 0000:00:1f.3: booting DSP firmware
> [ 379.484803] sof-audio-pci-intel-tgl 0000:00:1f.3: error: memory alloc failed: -12
> [ 379.484810] sof-audio-pci-intel-tgl 0000:00:1f.3: error: dma prepare for ICCMAX stream failed
> 
> Multiple fixes to reduce the memory usage of DSP boot have been
> identified in SOF driver, but even with those fixes, debug on affected
> systems has shown that even a single page alloc may fail with
> __GFP_NORETRY. When this occurs, system is under significant load on
> physical memory, but a lot of reclaimable pages are available, so the
> system has not run out of memory. With __GFP_RETRY_MAYFAIL, the errors
> are not hit in these stress tests.
> 
> The alloc failure is severe as audio capability is completely lost if
> alloc failure is hit at system resume.
> 
> An alternative solution was considered where the resources for DSP boot
> would be kept allocated until driver is unbound. This would avoid the
> allocation failure, but consume memory that is only needed temporarily
> at probe and resume time. It seems better to not hang on to the memory,
> but rather work a bit harder for allocating the pages at resume.
> 
> BugLink: https://github.com/thesofproject/linux/issues/3844
> Signed-off-by: Kai Vehmanen <kai.vehmanen@xxxxxxxxxxxxxxx>
> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@xxxxxxxxxxxxxxx>

Thanks, applied.


Takashi



[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Pulse Audio]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux