[alsa-devel] [PATCH] ALSA: Replace snd_malloc_pages() and snd_free_pages() with standard helpers

Takashi Sakamoto o-takashi at sakamocchi.jp
Sat Nov 24 16:12:33 CET 2018


Hi,

On Fri, Nov 23, 2018 at 09:35:26PM +0100, Takashi Iwai wrote:
> snd_malloc_pages() and snd_free_pages() are merely thin wrappers of
> the standard page allocator / free functions.  Even the arguments are
> compatible with some standard helpers, so there is little merit of
> keeping these wrappers.
> 
> This patch replaces the all existing callers of snd_malloc_pages() and
> snd_free_pages() with the direct calls of the standard helper
> functions.  In this version, we use a recently introduced one,
> alloc_pages_exact(), which suits better than the old
> snd_malloc_pages() implementation.  Then we can avoid the waste of
> pages by alignment to power-of-two.
> 
> Also, the __GFP_COMP flag that has been always added in the old
> implementation is dropped for most of callers now.  The only one that
> may still need it is the PCM buffer allocation which can be quite
> large.  The rest are single page allocations, so no sense to keep that
> flag.
> 
> With these conversions, snd_malloc_pages() and snd_free_pages() are
> dropped altogether from the whole tree.
> 
> Signed-off-by: Takashi Iwai <tiwai at suse.de>
> ---
>  include/sound/memalloc.h        |  4 ---
>  sound/core/memalloc.c           | 54 +++------------------------------
>  sound/core/pcm.c                | 14 ++++-----
>  sound/usb/usx2y/usX2Yhwdep.c    |  3 +-
>  sound/usb/usx2y/usbusx2y.c      |  3 +-
>  sound/usb/usx2y/usx2yhwdeppcm.c |  6 ++--
>  6 files changed, 19 insertions(+), 65 deletions(-)

Usage of 'alloc_pages_exact()' function and '__GFP_COMP' flag looks good
to me.

Reviewed-by: Takashi Sakamoto <o-takashi at sakamocchi.jp>

Messages from 01.org can be ignored because the past patches can
suppress it.


Regards

Takashi Sakamoto


More information about the Alsa-devel mailing list