From: Don Dutile <ddutile@redhat.com>
To: Denys Vlasenko <dvlasenk@redhat.com>, linux-kernel@vger.kernel.org
Cc: Marek Szyprowski <m.szyprowski@samsung.com>,
Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
David Woodhouse <dwmw2@infradead.org>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
Andi Kleen <andi@firstfloor.org>,
x86@kernel.org
Subject: Re: [PATCH v3] x86: deinline dma_alloc_attrs()
Date: Mon, 06 Apr 2015 15:20:32 -0400 [thread overview]
Message-ID: <5522DC80.9050807@redhat.com> (raw)
In-Reply-To: <1428347421-11432-1-git-send-email-dvlasenk@redhat.com>
On 04/06/2015 03:10 PM, Denys Vlasenko wrote:
> Reduces kernel size by 68739 bytes on allyesconfig build:
>
> text data bss dec hex filename
> 82662736 22255384 20627456 125545576 77bac68 vmlinux0
> 82594029 22255352 20627456 125476837 77a9fe5 vmlinux1
>
> Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
> Cc: Marek Szyprowski <m.szyprowski@samsung.com>
> Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> Cc: David Woodhouse <dwmw2@infradead.org>
> Cc: Don Dutile <ddutile@redhat.com>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Ingo Molnar <mingo@redhat.com>
> Cc: "H. Peter Anvin" <hpa@zytor.com>
> Cc: Andi Kleen <andi@firstfloor.org>
> Cc: x86@kernel.org
> Cc: linux-kernel@vger.kernel.org
> ---
>
> Changes in v2: added EXPORT_SYMBOL()
> Changes in v3: added *correct* EXPORT_SYMBOL()
>
> arch/x86/include/asm/dma-mapping.h | 28 ++--------------------------
> arch/x86/kernel/pci-dma.c | 27 +++++++++++++++++++++++++++
> 2 files changed, 29 insertions(+), 26 deletions(-)
>
> diff --git a/arch/x86/include/asm/dma-mapping.h b/arch/x86/include/asm/dma-mapping.h
> index 808dae6..6339320 100644
> --- a/arch/x86/include/asm/dma-mapping.h
> +++ b/arch/x86/include/asm/dma-mapping.h
> @@ -127,33 +127,9 @@ static inline gfp_t dma_alloc_coherent_gfp_flags(struct device *dev, gfp_t gfp)
>
> #define dma_alloc_coherent(d,s,h,f) dma_alloc_attrs(d,s,h,f,NULL)
>
> -static inline void *
> +void *
> dma_alloc_attrs(struct device *dev, size_t size, dma_addr_t *dma_handle,
> - gfp_t gfp, struct dma_attrs *attrs)
> -{
> - struct dma_map_ops *ops = get_dma_ops(dev);
> - void *memory;
> -
> - gfp &= ~(__GFP_DMA | __GFP_HIGHMEM | __GFP_DMA32);
> -
> - if (dma_alloc_from_coherent(dev, size, dma_handle, &memory))
> - return memory;
> -
> - if (!dev)
> - dev = &x86_dma_fallback_dev;
> -
> - if (!is_device_dma_capable(dev))
> - return NULL;
> -
> - if (!ops->alloc)
> - return NULL;
> -
> - memory = ops->alloc(dev, size, dma_handle,
> - dma_alloc_coherent_gfp_flags(dev, gfp), attrs);
> - debug_dma_alloc_coherent(dev, size, *dma_handle, memory);
> -
> - return memory;
> -}
> + gfp_t gfp, struct dma_attrs *attrs);
>
> #define dma_free_coherent(d,s,c,h) dma_free_attrs(d,s,c,h,NULL)
>
> diff --git a/arch/x86/kernel/pci-dma.c b/arch/x86/kernel/pci-dma.c
> index a25e202..74e2f6a 100644
> --- a/arch/x86/kernel/pci-dma.c
> +++ b/arch/x86/kernel/pci-dma.c
> @@ -140,6 +140,34 @@ void dma_generic_free_coherent(struct device *dev, size_t size, void *vaddr,
> free_pages((unsigned long)vaddr, get_order(size));
> }
>
> +void *dma_alloc_attrs(struct device *dev, size_t size, dma_addr_t *dma_handle,
> + gfp_t gfp, struct dma_attrs *attrs)
> +{
> + struct dma_map_ops *ops = get_dma_ops(dev);
> + void *memory;
> +
> + gfp &= ~(__GFP_DMA | __GFP_HIGHMEM | __GFP_DMA32);
> +
> + if (dma_alloc_from_coherent(dev, size, dma_handle, &memory))
> + return memory;
> +
> + if (!dev)
> + dev = &x86_dma_fallback_dev;
> +
> + if (!is_device_dma_capable(dev))
> + return NULL;
> +
> + if (!ops->alloc)
> + return NULL;
> +
> + memory = ops->alloc(dev, size, dma_handle,
> + dma_alloc_coherent_gfp_flags(dev, gfp), attrs);
> + debug_dma_alloc_coherent(dev, size, *dma_handle, memory);
> +
> + return memory;
> +}
> +EXPORT_SYMBOL(dma_alloc_attrs)
> +
> /*
> * See <Documentation/x86/x86_64/boot-options.txt> for the iommu kernel
> * parameter documentation.
>
Less inlining, correct export symbol.
Ack.
prev parent reply other threads:[~2015-04-06 19:21 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-06 19:10 [PATCH v3] x86: deinline dma_alloc_attrs() Denys Vlasenko
2015-04-06 19:10 ` [PATCH v3] x86: deinline dma_free_attrs() Denys Vlasenko
2015-04-06 19:20 ` Don Dutile [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5522DC80.9050807@redhat.com \
--to=ddutile@redhat.com \
--cc=andi@firstfloor.org \
--cc=dvlasenk@redhat.com \
--cc=dwmw2@infradead.org \
--cc=hpa@zytor.com \
--cc=konrad.wilk@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=m.szyprowski@samsung.com \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.