Re: [RFC] switch m68k to use the generic remapping DMA allocator

From: Geert Uytterhoeven
Date: Tue Jun 25 2019 - 04:08:06 EST


Hi Christoph,

On Tue, Jun 25, 2019 at 9:35 AM Christoph Hellwig <hch@xxxxxx> wrote:
> On Tue, Jun 25, 2019 at 09:26:48AM +0200, Geert Uytterhoeven wrote:
> > > > bloat-o-meter says:
> > > >
> > > > add/remove: 75/0 grow/shrink: 11/6 up/down: 4122/-82 (4040)
> > >
> > > What do these values stand for? The code should grow a little as
> > > we now need to include the the pool allocator for the above API
> > > fix.
> >
> > Last 3 values are "bytes added/removed (net increase)".
> > So this increases the static kernel size by ca. 4 KiB.
>
> That seems a lot for the little bit of pool code. Did m68k not

Exactly, hence my original question...

> build lib/genalloc.c by default before?

Indeed, CONFIG_GENERIC_ALLOCATOR wasn't enabled before.

--- .config.orig 2019-06-25 09:53:35.098691378 +0200
+++ .config 2019-06-25 09:59:23.914874446 +0200
@@ -2401,6 +2401,7 @@
CONFIG_DECOMPRESS_XZ=y
CONFIG_DECOMPRESS_LZO=y
CONFIG_DECOMPRESS_LZ4=y
+CONFIG_GENERIC_ALLOCATOR=y
CONFIG_TEXTSEARCH=y
CONFIG_TEXTSEARCH_KMP=m
CONFIG_TEXTSEARCH_BM=m
@@ -2409,6 +2410,10 @@
CONFIG_HAS_IOMEM=y
CONFIG_HAS_DMA=y
CONFIG_ARCH_HAS_SYNC_DMA_FOR_DEVICE=y
+CONFIG_ARCH_HAS_DMA_PREP_COHERENT=y
+CONFIG_ARCH_HAS_DMA_MMAP_PGPROT=y
+CONFIG_DMA_REMAP=y
+CONFIG_DMA_DIRECT_REMAP=y
# CONFIG_DMA_API_DEBUG is not set
CONFIG_SGL_ALLOC=y
CONFIG_DQL=y

> Also I'd be curious what the first 4 values are.

Reading scripts/bloat-o-meter in the kernel source tree tells me number of
added/removed symbols (functions or variables), and number of
grown/shrunk symbols.

I run it regularly, to catch silly mistakes (cfr. my favorite one, fixed
by commit 23c323af0375a7f6 ("SUNRPC: No, I did not intend to create a
256KiB hashtable")).

Full output before/after for an atari_defconfig kernel
(numbers are different, baseline has changed, too):

$ bloat-o-meter vmlinux.orig vmlinux
add/remove: 75/0 grow/shrink: 1/2 up/down: 4098/-28 (4070)
Function old new delta
gen_pool_alloc_algo_owner - 392 +392
dma_atomic_pool_init - 360 +360
gen_pool_best_fit - 248 +248
dma_common_contiguous_remap - 238 +238
gen_pool_destroy - 190 +190
gen_pool_free_owner - 184 +184
devm_gen_pool_create - 174 +174
dma_alloc_from_pool - 152 +152
bitmap_clear_ll - 138 +138
arch_dma_free 12 136 +124
dma_common_free_remap - 110 +110
gen_pool_add_owner - 108 +108
gen_pool_fixed_alloc - 100 +100
dma_common_pages_remap - 92 +92
gen_pool_dma_alloc - 78 +78
arch_dma_prep_coherent - 76 +76
clear_bits_ll - 66 +66
dma_free_from_pool - 62 +62
set_bits_ll - 60 +60
devm_gen_pool_match - 56 +56
addr_in_gen_pool - 56 +56
gen_pool_create - 54 +54
gen_pool_virt_to_phys - 52 +52
gen_pool_first_fit_align - 52 +52
gen_pool_for_each_chunk - 42 +42
gen_pool_get - 40 +40
gen_pool_first_fit_order_align - 36 +36
gen_pool_set_algo - 34 +34
early_coherent_pool - 32 +32
__kstrtab_gen_pool_first_fit_order_align - 31 +31
gen_pool_size - 30 +30
arch_dma_mmap_pgprot - 28 +28
dma_in_atomic_pool - 26 +26
__kstrtab_gen_pool_alloc_algo_owner - 26 +26
__kstrtab_gen_pool_first_fit_align - 25 +25
gen_pool_avail - 24 +24
__kstrtab_gen_pool_for_each_chunk - 24 +24
__kstrtab_gen_pool_virt_to_phys - 22 +22
__kstrtab_gen_pool_fixed_alloc - 21 +21
__kstrtab_devm_gen_pool_create - 21 +21
arch_dma_coherent_to_pfn - 20 +20
__kstrtab_gen_pool_free_owner - 20 +20
__kstrtab_gen_pool_first_fit - 19 +19
__kstrtab_gen_pool_dma_alloc - 19 +19
__kstrtab_gen_pool_add_owner - 19 +19
__kstrtab_gen_pool_set_algo - 18 +18
__kstrtab_gen_pool_best_fit - 18 +18
__kstrtab_gen_pool_destroy - 17 +17
__kstrtab_gen_pool_create - 16 +16
__kstrtab_gen_pool_avail - 15 +15
gen_pool_first_fit - 14 +14
devm_gen_pool_release - 14 +14
__setup_str_early_coherent_pool - 14 +14
__kstrtab_gen_pool_size - 14 +14
__kstrtab_gen_pool_get - 13 +13
__setup_early_coherent_pool - 12 +12
__ksymtab_gen_pool_virt_to_phys - 8 +8
__ksymtab_gen_pool_size - 8 +8
__ksymtab_gen_pool_set_algo - 8 +8
__ksymtab_gen_pool_get - 8 +8
__ksymtab_gen_pool_free_owner - 8 +8
__ksymtab_gen_pool_for_each_chunk - 8 +8
__ksymtab_gen_pool_fixed_alloc - 8 +8
__ksymtab_gen_pool_first_fit_order_align - 8 +8
__ksymtab_gen_pool_first_fit_align - 8 +8
__ksymtab_gen_pool_first_fit - 8 +8
__ksymtab_gen_pool_dma_alloc - 8 +8
__ksymtab_gen_pool_destroy - 8 +8
__ksymtab_gen_pool_create - 8 +8
__ksymtab_gen_pool_best_fit - 8 +8
__ksymtab_gen_pool_avail - 8 +8
__ksymtab_gen_pool_alloc_algo_owner - 8 +8
__ksymtab_gen_pool_add_owner - 8 +8
__ksymtab_devm_gen_pool_create - 8 +8
atomic_pool_size - 4 +4
atomic_pool - 4 +4
arch_dma_alloc 312 310 -2
dma_common_mmap 250 224 -26
Total: Before=3724055, After=3728125, chg +0.11%


Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds