All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marek Szyprowski <m.szyprowski@samsung.com>
To: "'Russell King - ARM Linux'" <linux@arm.linux.org.uk>
Cc: linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-media@vger.kernel.org, linux-mm@kvack.org,
	linaro-mm-sig@lists.linaro.org,
	"'Daniel Walker'" <dwalker@codeaurora.org>,
	"'Arnd Bergmann'" <arnd@arndb.de>,
	"'Jonathan Corbet'" <corbet@lwn.net>,
	"'Mel Gorman'" <mel@csn.ul.ie>,
	"'Chunsang Jeong'" <chunsang.jeong@linaro.org>,
	"'Michal Nazarewicz'" <mina86@mina86.com>,
	"'Jesse Barker'" <jesse.barker@linaro.org>,
	"'Kyungmin Park'" <kyungmin.park@samsung.com>,
	"'Ankita Garg'" <ankita@in.ibm.com>,
	"'Andrew Morton'" <akpm@linux-foundation.org>,
	"'KAMEZAWA Hiroyuki'" <kamezawa.hiroyu@jp.fujitsu.com>,
	Marek Szyprowski <m.szyprowski@samsung.com>
Subject: RE: [PATCH 6/8] drivers: add Contiguous Memory Allocator
Date: Wed, 06 Jul 2011 15:58:58 +0200	[thread overview]
Message-ID: <006301cc3be4$daab1850$900148f0$%szyprowski@samsung.com> (raw)
In-Reply-To: <20110705113345.GA8286@n2100.arm.linux.org.uk>

Hello,

On Tuesday, July 05, 2011 1:34 PM Russell King - ARM Linux wrote:

> On Tue, Jul 05, 2011 at 09:41:48AM +0200, Marek Szyprowski wrote:
> > The Contiguous Memory Allocator is a set of helper functions for DMA
> > mapping framework that improves allocations of contiguous memory chunks.
> >
> > CMA grabs memory on system boot, marks it with CMA_MIGRATE_TYPE and
> > gives back to the system. Kernel is allowed to allocate movable pages
> > within CMA's managed memory so that it can be used for example for page
> > cache when DMA mapping do not use it. On dma_alloc_from_contiguous()
> > request such pages are migrated out of CMA area to free required
> > contiguous block and fulfill the request. This allows to allocate large
> > contiguous chunks of memory at any time assuming that there is enough
> > free memory available in the system.
> >
> > This code is heavily based on earlier works by Michal Nazarewicz.
> 
> And how are you addressing the technical concerns about aliasing of
> cache attributes which I keep bringing up with this and you keep
> ignoring and telling me that I'm standing in your way.

I'm perfectly aware of the issues with aliasing of cache attributes.

My idea is to change low memory linear mapping for all CMA areas on boot
time to use 2 level page tables (4KiB mappings instead of super-section
mappings). This way the page properties for a single page in CMA area can
be changed/updated at any time to match required coherent/writecombine
attributes. Linear mapping can be even removed completely if we want to 
create the it elsewhere in the address space. 

The only problem that might need to be resolved is GFP_ATOMIC allocation
(updating page properties probably requires some locking), but it can be
served from a special area which is created on boot without low-memory
mapping at all. None sane driver will call dma_alloc_coherent(GFP_ATOMIC)
for large buffers anyway.

CMA limits the memory area from which coherent pages are being taken quite
well, so the change in the linear mapping method should have no significant
impact on the system performance.

I didn't implement such solution yet, because it is really hard to handle
all issues at the same time and creating the allocator was just a first
step.

Best regards
-- 
Marek Szyprowski
Samsung Poland R&D Center




WARNING: multiple messages have this Message-ID (diff)
From: Marek Szyprowski <m.szyprowski@samsung.com>
To: 'Russell King - ARM Linux' <linux@arm.linux.org.uk>
Cc: linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-media@vger.kernel.org, linux-mm@kvack.org,
	linaro-mm-sig@lists.linaro.org,
	'Daniel Walker' <dwalker@codeaurora.org>,
	'Arnd Bergmann' <arnd@arndb.de>,
	'Jonathan Corbet' <corbet@lwn.net>, 'Mel Gorman' <mel@csn.ul.ie>,
	'Chunsang Jeong' <chunsang.jeong@linaro.org>,
	'Michal Nazarewicz' <mina86@mina86.com>,
	'Jesse Barker' <jesse.barker@linaro.org>,
	'Kyungmin Park' <kyungmin.park@samsung.com>,
	'Ankita Garg' <ankita@in.ibm.com>,
	'Andrew Morton' <akpm@linux-foundation.org>,
	'KAMEZAWA Hiroyuki' <kamezawa.hiroyu@jp.fujitsu.com>,
	Marek Szyprowski <m.szyprowski@samsung.com>
Subject: RE: [PATCH 6/8] drivers: add Contiguous Memory Allocator
Date: Wed, 06 Jul 2011 15:58:58 +0200	[thread overview]
Message-ID: <006301cc3be4$daab1850$900148f0$%szyprowski@samsung.com> (raw)
In-Reply-To: <20110705113345.GA8286@n2100.arm.linux.org.uk>

Hello,

On Tuesday, July 05, 2011 1:34 PM Russell King - ARM Linux wrote:

> On Tue, Jul 05, 2011 at 09:41:48AM +0200, Marek Szyprowski wrote:
> > The Contiguous Memory Allocator is a set of helper functions for DMA
> > mapping framework that improves allocations of contiguous memory chunks.
> >
> > CMA grabs memory on system boot, marks it with CMA_MIGRATE_TYPE and
> > gives back to the system. Kernel is allowed to allocate movable pages
> > within CMA's managed memory so that it can be used for example for page
> > cache when DMA mapping do not use it. On dma_alloc_from_contiguous()
> > request such pages are migrated out of CMA area to free required
> > contiguous block and fulfill the request. This allows to allocate large
> > contiguous chunks of memory at any time assuming that there is enough
> > free memory available in the system.
> >
> > This code is heavily based on earlier works by Michal Nazarewicz.
> 
> And how are you addressing the technical concerns about aliasing of
> cache attributes which I keep bringing up with this and you keep
> ignoring and telling me that I'm standing in your way.

I'm perfectly aware of the issues with aliasing of cache attributes.

My idea is to change low memory linear mapping for all CMA areas on boot
time to use 2 level page tables (4KiB mappings instead of super-section
mappings). This way the page properties for a single page in CMA area can
be changed/updated at any time to match required coherent/writecombine
attributes. Linear mapping can be even removed completely if we want to 
create the it elsewhere in the address space. 

The only problem that might need to be resolved is GFP_ATOMIC allocation
(updating page properties probably requires some locking), but it can be
served from a special area which is created on boot without low-memory
mapping at all. None sane driver will call dma_alloc_coherent(GFP_ATOMIC)
for large buffers anyway.

CMA limits the memory area from which coherent pages are being taken quite
well, so the change in the linear mapping method should have no significant
impact on the system performance.

I didn't implement such solution yet, because it is really hard to handle
all issues at the same time and creating the allocator was just a first
step.

Best regards
-- 
Marek Szyprowski
Samsung Poland R&D Center



--
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>

WARNING: multiple messages have this Message-ID (diff)
From: m.szyprowski@samsung.com (Marek Szyprowski)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 6/8] drivers: add Contiguous Memory Allocator
Date: Wed, 06 Jul 2011 15:58:58 +0200	[thread overview]
Message-ID: <006301cc3be4$daab1850$900148f0$%szyprowski@samsung.com> (raw)
In-Reply-To: <20110705113345.GA8286@n2100.arm.linux.org.uk>

Hello,

On Tuesday, July 05, 2011 1:34 PM Russell King - ARM Linux wrote:

> On Tue, Jul 05, 2011 at 09:41:48AM +0200, Marek Szyprowski wrote:
> > The Contiguous Memory Allocator is a set of helper functions for DMA
> > mapping framework that improves allocations of contiguous memory chunks.
> >
> > CMA grabs memory on system boot, marks it with CMA_MIGRATE_TYPE and
> > gives back to the system. Kernel is allowed to allocate movable pages
> > within CMA's managed memory so that it can be used for example for page
> > cache when DMA mapping do not use it. On dma_alloc_from_contiguous()
> > request such pages are migrated out of CMA area to free required
> > contiguous block and fulfill the request. This allows to allocate large
> > contiguous chunks of memory at any time assuming that there is enough
> > free memory available in the system.
> >
> > This code is heavily based on earlier works by Michal Nazarewicz.
> 
> And how are you addressing the technical concerns about aliasing of
> cache attributes which I keep bringing up with this and you keep
> ignoring and telling me that I'm standing in your way.

I'm perfectly aware of the issues with aliasing of cache attributes.

My idea is to change low memory linear mapping for all CMA areas on boot
time to use 2 level page tables (4KiB mappings instead of super-section
mappings). This way the page properties for a single page in CMA area can
be changed/updated at any time to match required coherent/writecombine
attributes. Linear mapping can be even removed completely if we want to 
create the it elsewhere in the address space. 

The only problem that might need to be resolved is GFP_ATOMIC allocation
(updating page properties probably requires some locking), but it can be
served from a special area which is created on boot without low-memory
mapping at all. None sane driver will call dma_alloc_coherent(GFP_ATOMIC)
for large buffers anyway.

CMA limits the memory area from which coherent pages are being taken quite
well, so the change in the linear mapping method should have no significant
impact on the system performance.

I didn't implement such solution yet, because it is really hard to handle
all issues at the same time and creating the allocator was just a first
step.

Best regards
-- 
Marek Szyprowski
Samsung Poland R&D Center

  parent reply	other threads:[~2011-07-06 13:59 UTC|newest]

Thread overview: 183+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-05  7:41 [PATCHv11 0/8] Contiguous Memory Allocator Marek Szyprowski
2011-07-05  7:41 ` Marek Szyprowski
2011-07-05  7:41 ` Marek Szyprowski
2011-07-05  7:41 ` [PATCH 1/8] mm: move some functions from memory_hotplug.c to page_isolation.c Marek Szyprowski
2011-07-05  7:41   ` Marek Szyprowski
2011-07-05  7:41   ` Marek Szyprowski
2011-07-05 11:27   ` Arnd Bergmann
2011-07-05 11:27     ` Arnd Bergmann
2011-07-05 11:27     ` Arnd Bergmann
2011-07-05  7:41 ` [PATCH 2/8] mm: alloc_contig_freed_pages() added Marek Szyprowski
2011-07-05  7:41   ` Marek Szyprowski
2011-07-05  7:41   ` Marek Szyprowski
2011-07-05 11:30   ` Arnd Bergmann
2011-07-05 11:30     ` Arnd Bergmann
2011-07-05 11:30     ` Arnd Bergmann
2011-07-05  7:41 ` [PATCH 3/8] mm: alloc_contig_range() added Marek Szyprowski
2011-07-05  7:41   ` Marek Szyprowski
2011-07-05  7:41   ` Marek Szyprowski
2011-07-05 11:31   ` Arnd Bergmann
2011-07-05 11:31     ` Arnd Bergmann
2011-07-05 11:31     ` Arnd Bergmann
2011-07-05  7:41 ` [PATCH 4/8] mm: MIGRATE_CMA migration type added Marek Szyprowski
2011-07-05  7:41   ` Marek Szyprowski
2011-07-05  7:41   ` Marek Szyprowski
2011-07-05 11:44   ` Arnd Bergmann
2011-07-05 11:44     ` Arnd Bergmann
2011-07-05 11:44     ` Arnd Bergmann
2011-07-05 12:27     ` Russell King - ARM Linux
2011-07-05 12:27       ` Russell King - ARM Linux
2011-07-05 12:27       ` Russell King - ARM Linux
2011-07-05  7:41 ` [PATCH 5/8] mm: MIGRATE_CMA isolation functions added Marek Szyprowski
2011-07-05  7:41   ` Marek Szyprowski
2011-07-05  7:41   ` Marek Szyprowski
2011-07-05 11:45   ` Arnd Bergmann
2011-07-05 11:45     ` Arnd Bergmann
2011-07-05 11:45     ` Arnd Bergmann
2011-07-05  7:41 ` [PATCH 6/8] drivers: add Contiguous Memory Allocator Marek Szyprowski
2011-07-05  7:41   ` Marek Szyprowski
2011-07-05  7:41   ` Marek Szyprowski
2011-07-05 10:24   ` Marek Szyprowski
2011-07-05 10:24     ` Marek Szyprowski
2011-07-05 10:24     ` Marek Szyprowski
2011-07-05 11:02   ` [PATCH 6/8 RESEND] " Marek Szyprowski
2011-07-05 11:02     ` Marek Szyprowski
2011-07-05 11:02     ` Marek Szyprowski
2011-07-05 11:50     ` Arnd Bergmann
2011-07-05 11:50       ` Arnd Bergmann
2011-07-05 11:50       ` Arnd Bergmann
2011-07-05 11:33   ` [PATCH 6/8] " Russell King - ARM Linux
2011-07-05 11:33     ` Russell King - ARM Linux
2011-07-05 11:33     ` Russell King - ARM Linux
2011-07-05 12:27     ` Arnd Bergmann
2011-07-05 12:27       ` Arnd Bergmann
2011-07-05 12:27       ` Arnd Bergmann
2011-07-05 12:30       ` Russell King - ARM Linux
2011-07-05 12:30         ` Russell King - ARM Linux
2011-07-05 12:30         ` Russell King - ARM Linux
2011-07-05 13:58         ` Arnd Bergmann
2011-07-05 13:58           ` Arnd Bergmann
2011-07-05 13:58           ` Arnd Bergmann
2011-07-08 17:25           ` Russell King - ARM Linux
2011-07-08 17:25             ` Russell King - ARM Linux
2011-07-08 17:25             ` Russell King - ARM Linux
2011-07-12 13:39             ` Arnd Bergmann
2011-07-12 13:39               ` Arnd Bergmann
2011-07-12 13:39               ` Arnd Bergmann
2011-08-03 17:43       ` James Bottomley
2011-08-03 17:43         ` James Bottomley
2011-08-03 17:43         ` James Bottomley
2011-09-26 12:06         ` Marek Szyprowski
2011-09-26 12:06           ` Marek Szyprowski
2011-09-26 12:06           ` Marek Szyprowski
2011-09-26 13:00         ` Russell King - ARM Linux
2011-09-26 13:00           ` Russell King - ARM Linux
2011-09-26 13:00           ` Russell King - ARM Linux
2011-07-06 13:58     ` Marek Szyprowski [this message]
2011-07-06 13:58       ` Marek Szyprowski
2011-07-06 13:58       ` Marek Szyprowski
2011-07-06 14:09       ` Arnd Bergmann
2011-07-06 14:09         ` Arnd Bergmann
2011-07-06 14:09         ` Arnd Bergmann
2011-07-06 14:23         ` Russell King - ARM Linux
2011-07-06 14:23           ` Russell King - ARM Linux
2011-07-06 14:23           ` Russell King - ARM Linux
2011-07-06 14:37           ` [Linaro-mm-sig] " Nicolas Pitre
2011-07-06 14:37             ` Nicolas Pitre
2011-07-06 14:37             ` Nicolas Pitre
2011-07-06 14:59             ` Arnd Bergmann
2011-07-06 14:59               ` Arnd Bergmann
2011-07-06 14:59               ` Arnd Bergmann
2011-07-09 14:57               ` Janusz Krzysztofik
2011-07-09 14:57                 ` Janusz Krzysztofik
2011-07-09 14:57                 ` Janusz Krzysztofik
2011-07-11 13:47                 ` Marek Szyprowski
2011-07-11 13:47                   ` Marek Szyprowski
2011-07-11 13:47                   ` Marek Szyprowski
2011-07-11 19:01                   ` Janusz Krzysztofik
2011-07-11 19:01                     ` Janusz Krzysztofik
2011-07-11 19:01                     ` Janusz Krzysztofik
2011-07-12  5:34                     ` Marek Szyprowski
2011-07-12  5:34                       ` Marek Szyprowski
2011-07-12  5:34                       ` Marek Szyprowski
2011-07-06 14:51           ` Arnd Bergmann
2011-07-06 14:51             ` Arnd Bergmann
2011-07-06 14:51             ` Arnd Bergmann
2011-07-06 15:48             ` Russell King - ARM Linux
2011-07-06 15:48               ` Russell King - ARM Linux
2011-07-06 15:48               ` Russell King - ARM Linux
2011-07-06 16:05               ` Christoph Lameter
2011-07-06 16:05                 ` Christoph Lameter
2011-07-06 16:05                 ` Christoph Lameter
2011-07-06 16:09                 ` Michal Nazarewicz
2011-07-06 16:09                   ` Michal Nazarewicz
2011-07-06 16:09                   ` Michal Nazarewicz
2011-07-06 16:19                   ` Christoph Lameter
2011-07-06 16:19                     ` Christoph Lameter
2011-07-06 16:19                     ` Christoph Lameter
2011-07-06 17:15                     ` Russell King - ARM Linux
2011-07-06 17:15                       ` Russell King - ARM Linux
2011-07-06 17:15                       ` Russell King - ARM Linux
2011-07-06 19:03                       ` Christoph Lameter
2011-07-06 19:03                         ` Christoph Lameter
2011-07-06 19:03                         ` Christoph Lameter
2011-07-06 17:02                 ` Russell King - ARM Linux
2011-07-06 17:02                   ` Russell King - ARM Linux
2011-07-06 17:02                   ` Russell King - ARM Linux
2011-07-06 16:31               ` Arnd Bergmann
2011-07-06 16:31                 ` Arnd Bergmann
2011-07-06 16:31                 ` Arnd Bergmann
2011-07-06 19:10                 ` Nicolas Pitre
2011-07-06 19:10                   ` Nicolas Pitre
2011-07-06 19:10                   ` Nicolas Pitre
2011-07-06 20:23                   ` [Linaro-mm-sig] " Arnd Bergmann
2011-07-06 20:23                     ` Arnd Bergmann
2011-07-06 20:23                     ` Arnd Bergmann
2011-07-07  5:29                     ` Nicolas Pitre
2011-07-07  5:29                       ` Nicolas Pitre
2011-07-07  5:29                       ` Nicolas Pitre
2011-07-06 14:56         ` Marek Szyprowski
2011-07-06 14:56           ` Marek Szyprowski
2011-07-06 14:56           ` Marek Szyprowski
2011-07-06 15:37           ` Russell King - ARM Linux
2011-07-06 15:37             ` Russell King - ARM Linux
2011-07-06 15:37             ` Russell King - ARM Linux
2011-07-06 15:47             ` Marek Szyprowski
2011-07-06 15:47               ` Marek Szyprowski
2011-07-06 15:47               ` Marek Szyprowski
2011-07-14 12:29   ` Marek Szyprowski
2011-07-14 12:29     ` Marek Szyprowski
2011-07-14 12:29     ` Marek Szyprowski
2011-07-05  7:41 ` [PATCH 7/8] ARM: integrate CMA with dma-mapping subsystem Marek Szyprowski
2011-07-05  7:41   ` Marek Szyprowski
2011-07-05  7:41   ` Marek Szyprowski
2011-07-05 11:50   ` Arnd Bergmann
2011-07-05 11:50     ` Arnd Bergmann
2011-07-05 11:50     ` Arnd Bergmann
2011-07-05  7:41 ` [PATCH 8/8] ARM: S5PV210: example of CMA private area for FIMC device on Goni board Marek Szyprowski
2011-07-05  7:41   ` Marek Szyprowski
2011-07-05  7:41   ` Marek Szyprowski
2011-07-05 11:51   ` Arnd Bergmann
2011-07-05 11:51     ` Arnd Bergmann
2011-07-05 11:51     ` Arnd Bergmann
2011-07-05 12:07 ` [PATCHv11 0/8] Contiguous Memory Allocator Arnd Bergmann
2011-07-05 12:07   ` Arnd Bergmann
2011-07-05 12:07   ` Arnd Bergmann
2011-07-05 12:28   ` Russell King - ARM Linux
2011-07-05 12:28     ` Russell King - ARM Linux
2011-07-05 12:28     ` Russell King - ARM Linux
2011-07-06 22:11   ` Andrew Morton
2011-07-06 22:11     ` Andrew Morton
2011-07-06 22:11     ` Andrew Morton
2011-07-07  7:36     ` Arnd Bergmann
2011-07-07  7:36       ` Arnd Bergmann
2011-07-07  7:36       ` Arnd Bergmann
2011-07-11 13:24     ` Marek Szyprowski
2011-07-11 13:24       ` Marek Szyprowski
2011-07-11 13:24       ` Marek Szyprowski
2011-07-20  8:57 [PATCHv12 " Marek Szyprowski
2011-07-20  8:57 ` [PATCH 6/8] drivers: add " Marek Szyprowski
2011-07-20  8:57   ` Marek Szyprowski
2011-07-20  8:57   ` Marek Szyprowski
2011-08-19 14:27 [PATCHv15 0/8] " Marek Szyprowski
2011-08-19 14:27 ` [PATCH 6/8] drivers: add " Marek Szyprowski
2011-08-19 14:27   ` Marek Szyprowski
2011-08-19 14:27   ` 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='006301cc3be4$daab1850$900148f0$%szyprowski@samsung.com' \
    --to=m.szyprowski@samsung.com \
    --cc=akpm@linux-foundation.org \
    --cc=ankita@in.ibm.com \
    --cc=arnd@arndb.de \
    --cc=chunsang.jeong@linaro.org \
    --cc=corbet@lwn.net \
    --cc=dwalker@codeaurora.org \
    --cc=jesse.barker@linaro.org \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=kyungmin.park@samsung.com \
    --cc=linaro-mm-sig@lists.linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux@arm.linux.org.uk \
    --cc=mel@csn.ul.ie \
    --cc=mina86@mina86.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 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.