linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: Marek Szyprowski <m.szyprowski@samsung.com>
Cc: 'Krishna Reddy' <vdumpa@nvidia.com>,
	linux-arm-kernel@lists.infradead.org,
	linaro-mm-sig@lists.linaro.org, linux-mm@kvack.org,
	linux-arch@vger.kernel.org, linux-samsung-soc@vger.kernel.org,
	iommu@lists.linux-foundation.org,
	'Kyungmin Park' <kyungmin.park@samsung.com>,
	'Joerg Roedel' <joro@8bytes.org>,
	'Russell King - ARM Linux' <linux@arm.linux.org.uk>,
	'Shariq Hasnain' <shariq.hasnain@linaro.org>,
	'Chunsang Jeong' <chunsang.jeong@linaro.org>,
	'KyongHo Cho' <pullip.cho@samsung.com>,
	Andrzej Pietrasiewicz <andrzej.p@samsung.com>,
	'Benjamin Herrenschmidt' <benh@kernel.crashing.org>
Subject: Re: [PATCHv6 7/7] ARM: dma-mapping: add support for IOMMU mapper
Date: Fri, 24 Feb 2012 12:49:44 +0000	[thread overview]
Message-ID: <201202241249.44731.arnd@arndb.de> (raw)
In-Reply-To: <00f301ccf2d7$b5b68570$21239050$%szyprowski@samsung.com>

On Friday 24 February 2012, Marek Szyprowski wrote:
> > > +static struct page **__iommu_alloc_buffer(struct device *dev, size_t
> > > +size, gfp_t gfp) {
> > > +     struct page **pages;
> > > +     int count = size >> PAGE_SHIFT;
> > > +     int i=0;
> > > +
> > > +     pages = kzalloc(count * sizeof(struct page*), gfp);
> > > +     if (!pages)
> > > +             return NULL;
> > 
> > kzalloc can fail for any size bigger than PAGE_SIZE, if the system memory is
> > fully fragmented.
> > If there is a request for size bigger than 4MB, then the pages pointer array won't
> > Fit in one page and kzalloc may fail. we should use vzalloc()/vfree()
> > when pages pointer array size needed is bigger than PAGE_SIZE.
> 
> Right, thanks for spotting this. I will fix this in the next version.

It's not clear though if that is the best solution. vzalloc comes at the
price of using up space in the vmalloc area and as well as extra TLB entries,
so we try to limit its use where possible. The other current code might fail
in out of memory situations, but if a user wants to allocate a >4MB buffer
(using up more than one physically contiguous page of pointers to pages), the
following allocation of >1024 pages will likely fail as well, so we might
just fail early.

	Arnd

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2012-02-24 12:49 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-10 18:58 [PATCHv6 0/7] ARM: DMA-mapping framework redesign Marek Szyprowski
2012-02-10 18:58 ` [PATCHv6 1/7] ARM: dma-mapping: remove offset parameter to prepare for generic dma_ops Marek Szyprowski
2012-02-10 18:58 ` [PATCHv6 2/7] ARM: dma-mapping: use asm-generic/dma-mapping-common.h Marek Szyprowski
2012-02-14 15:01   ` Konrad Rzeszutek Wilk
2012-02-10 18:58 ` [PATCHv6 3/7] ARM: dma-mapping: implement dma sg methods on top of any generic dma ops Marek Szyprowski
2012-02-14 15:02   ` Konrad Rzeszutek Wilk
2012-02-24 13:24     ` Marek Szyprowski
2012-02-10 18:58 ` [PATCHv6 4/7] ARM: dma-mapping: move all dma bounce code to separate dma ops structure Marek Szyprowski
2012-02-10 18:58 ` [PATCHv6 5/7] ARM: dma-mapping: remove redundant code and cleanup Marek Szyprowski
2012-02-10 18:58 ` [PATCHv6 6/7] ARM: dma-mapping: use alloc, mmap, free from dma_ops Marek Szyprowski
2012-02-10 18:58 ` [PATCHv6 7/7] ARM: dma-mapping: add support for IOMMU mapper Marek Szyprowski
2012-02-13 18:18   ` Krishna Reddy
2012-02-13 19:58   ` Krishna Reddy
2012-02-24  9:35     ` Marek Szyprowski
2012-02-24 12:49       ` Arnd Bergmann [this message]
2012-02-24 13:18         ` Marek Szyprowski
2012-02-24 14:31           ` Arnd Bergmann
2012-02-24 15:30             ` Marek Szyprowski
2012-02-14 14:55   ` Konrad Rzeszutek Wilk
2012-02-24 13:12     ` Marek Szyprowski

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=201202241249.44731.arnd@arndb.de \
    --to=arnd@arndb.de \
    --cc=andrzej.p@samsung.com \
    --cc=benh@kernel.crashing.org \
    --cc=chunsang.jeong@linaro.org \
    --cc=iommu@lists.linux-foundation.org \
    --cc=joro@8bytes.org \
    --cc=kyungmin.park@samsung.com \
    --cc=linaro-mm-sig@lists.linaro.org \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=m.szyprowski@samsung.com \
    --cc=pullip.cho@samsung.com \
    --cc=shariq.hasnain@linaro.org \
    --cc=vdumpa@nvidia.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox