From: Arnd Bergmann <arnd@arndb.de>
To: Marek Szyprowski <m.szyprowski@samsung.com>
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,
Michal Nazarewicz <mina86@mina86.com>,
Kyungmin Park <kyungmin.park@samsung.com>,
Andrew Morton <akpm@linux-foundation.org>,
KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
Ankita Garg <ankita@in.ibm.com>,
Daniel Walker <dwalker@codeaurora.org>,
Mel Gorman <mel@csn.ul.ie>,
Jesse Barker <jesse.barker@linaro.org>,
Jonathan Corbet <corbet@lwn.net>,
Chunsang Jeong <chunsang.jeong@linaro.org>
Subject: Re: [PATCH 4/8] mm: MIGRATE_CMA migration type added
Date: Tue, 5 Jul 2011 13:44:31 +0200 [thread overview]
Message-ID: <201107051344.31298.arnd@arndb.de> (raw)
In-Reply-To: <1309851710-3828-5-git-send-email-m.szyprowski@samsung.com>
On Tuesday 05 July 2011, Marek Szyprowski wrote:
> From: Michal Nazarewicz <m.nazarewicz@samsung.com>
>
> The MIGRATE_CMA migration type has two main characteristics:
> (i) only movable pages can be allocated from MIGRATE_CMA
> pageblocks and (ii) page allocator will never change migration
> type of MIGRATE_CMA pageblocks.
>
> This guarantees that page in a MIGRATE_CMA page block can
> always be migrated somewhere else (unless there's no memory left
> in the system).
>
> It is designed to be used with Contiguous Memory Allocator
> (CMA) for allocating big chunks (eg. 10MiB) of physically
> contiguous memory. Once driver requests contiguous memory,
> CMA will migrate pages from MIGRATE_CMA pageblocks.
>
> To minimise number of migrations, MIGRATE_CMA migration type
> is the last type tried when page allocator falls back to other
> migration types then requested.
>
> Signed-off-by: Michal Nazarewicz <m.nazarewicz@samsung.com>
> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> [m.szyprowski: cleaned up Kconfig, renamed some functions]
> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
> CC: Michal Nazarewicz <mina86@mina86.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>, but I noticed a few things:
> cma migrate fixup
This text doesn't belong here.
> +enum {
> + MIGRATE_UNMOVABLE,
> + MIGRATE_RECLAIMABLE,
> + MIGRATE_MOVABLE,
> + MIGRATE_PCPTYPES, /* the number of types on the pcp lists */
> + MIGRATE_RESERVE = MIGRATE_PCPTYPES,
> +#ifdef CONFIG_CMA_MIGRATE_TYPE
> + /*
> + * MIGRATE_CMA migration type is designed to mimic the way
> + * ZONE_MOVABLE works. Only movable pages can be allocated
> + * from MIGRATE_CMA pageblocks and page allocator never
> + * implicitly change migration type of MIGRATE_CMA pageblock.
> + *
> + * The way to use it is to change migratetype of a range of
> + * pageblocks to MIGRATE_CMA which can be done by
> + * __free_pageblock_cma() function. What is important though
> + * is that a range of pageblocks must be aligned to
> + * MAX_ORDER_NR_PAGES should biggest page be bigger then
> + * a single pageblock.
> + */
> + MIGRATE_CMA,
> +#endif
> + MIGRATE_ISOLATE, /* can't allocate from here */
> + MIGRATE_TYPES
> +};
It's not clear to me why you need this #ifdef. Does it hurt if the
migration type is defined but not used?
> @@ -198,6 +198,12 @@ config MIGRATION
> pages as migration can relocate pages to satisfy a huge page
> allocation instead of reclaiming.
>
> +config CMA_MIGRATE_TYPE
> + bool
> + help
> + This enables the use the MIGRATE_CMA migrate type, which lets lets CMA
> + work on almost arbitrary memory range and not only inside ZONE_MOVABLE.
> +
> config PHYS_ADDR_T_64BIT
> def_bool 64BIT || ARCH_PHYS_ADDR_T_64BIT
This is currently only selected on ARM with your patch set.
> diff --git a/mm/compaction.c b/mm/compaction.c
> index 6cc604b..9e5cc59 100644
> --- a/mm/compaction.c
> +++ b/mm/compaction.c
> @@ -119,6 +119,16 @@ static bool suitable_migration_target(struct page *page)
> if (migratetype == MIGRATE_ISOLATE || migratetype == MIGRATE_RESERVE)
> return false;
>
> + /* Keep MIGRATE_CMA alone as well. */
> + /*
> + * XXX Revisit. We currently cannot let compaction touch CMA
> + * pages since compaction insists on changing their migration
> + * type to MIGRATE_MOVABLE (see split_free_page() called from
> + * isolate_freepages_block() above).
> + */
> + if (is_migrate_cma(migratetype))
> + return false;
> +
> /* If the page is a large free page, then allow migration */
> if (PageBuddy(page) && page_order(page) >= pageblock_order)
> return true;
Do you plan to fix address this before merging the patch set, or is
it harmless enough to get in this way?
> /*
> * The order of subdivision here is critical for the IO subsystem.
> @@ -827,11 +852,15 @@ struct page *__rmqueue_smallest(struct zone *zone, unsigned int order,
> * This array describes the order lists are fallen back to when
> * the free lists for the desirable migrate type are depleted
> */
> -static int fallbacks[MIGRATE_TYPES][MIGRATE_TYPES-1] = {
> +static int fallbacks[MIGRATE_TYPES][4] = {
> [MIGRATE_UNMOVABLE] = { MIGRATE_RECLAIMABLE, MIGRATE_MOVABLE, MIGRATE_RESERVE },
> [MIGRATE_RECLAIMABLE] = { MIGRATE_UNMOVABLE, MIGRATE_MOVABLE, MIGRATE_RESERVE },
> +#ifdef CONFIG_CMA_MIGRATE_TYPE
> + [MIGRATE_MOVABLE] = { MIGRATE_RECLAIMABLE, MIGRATE_UNMOVABLE, MIGRATE_CMA , MIGRATE_RESERVE },
> +#else
> [MIGRATE_MOVABLE] = { MIGRATE_RECLAIMABLE, MIGRATE_UNMOVABLE, MIGRATE_RESERVE },
> - [MIGRATE_RESERVE] = { MIGRATE_RESERVE, MIGRATE_RESERVE, MIGRATE_RESERVE }, /* Never used */
> +#endif
> + [MIGRATE_RESERVE] = { MIGRATE_RESERVE }, /* Never used */
> };
>
> /*
> @@ -1044,7 +1086,12 @@ static int rmqueue_bulk(struct zone *zone, unsigned int order,
> list_add(&page->lru, list);
> else
> list_add_tail(&page->lru, list);
> - set_page_private(page, migratetype);
> +#ifdef CONFIG_CMA_MIGRATE_TYPE
> + if (is_pageblock_cma(page))
> + set_page_private(page, MIGRATE_CMA);
> + else
> +#endif
> + set_page_private(page, migratetype);
> list = &page->lru;
> }
I guess if you can get rid of the first #ifdef I mentioned above, these two can be
removed as well, without causing any run-time overhead.
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>
next prev parent reply other threads:[~2011-07-05 11:45 UTC|newest]
Thread overview: 61+ 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 ` [PATCH 1/8] mm: move some functions from memory_hotplug.c to page_isolation.c Marek Szyprowski
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 11:30 ` Arnd Bergmann
2011-07-05 7:41 ` [PATCH 3/8] mm: alloc_contig_range() added Marek Szyprowski
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 11:44 ` Arnd Bergmann [this message]
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 11:45 ` Arnd Bergmann
2011-07-05 7:41 ` [PATCH 6/8] drivers: add Contiguous Memory Allocator Marek Szyprowski
2011-07-05 10:24 ` Marek Szyprowski
2011-07-05 11:02 ` [PATCH 6/8 RESEND] " Marek Szyprowski
2011-07-05 11:50 ` Arnd Bergmann
2011-07-05 11:33 ` [PATCH 6/8] " Russell King - ARM Linux
2011-07-05 12:27 ` Arnd Bergmann
2011-07-05 12:30 ` Russell King - ARM Linux
2011-07-05 13:58 ` Arnd Bergmann
2011-07-08 17:25 ` Russell King - ARM Linux
2011-07-12 13:39 ` Arnd Bergmann
2011-08-03 17:43 ` James Bottomley
2011-09-26 12:06 ` Marek Szyprowski
2011-09-26 13:00 ` Russell King - ARM Linux
2011-07-06 13:58 ` Marek Szyprowski
2011-07-06 14:09 ` Arnd Bergmann
2011-07-06 14:23 ` Russell King - ARM Linux
2011-07-06 14:37 ` [Linaro-mm-sig] " Nicolas Pitre
2011-07-06 14:59 ` Arnd Bergmann
2011-07-09 14:57 ` Janusz Krzysztofik
2011-07-11 13:47 ` Marek Szyprowski
2011-07-11 19:01 ` Janusz Krzysztofik
2011-07-12 5:34 ` Marek Szyprowski
2011-07-06 14:51 ` Arnd Bergmann
2011-07-06 15:48 ` Russell King - ARM Linux
2011-07-06 16:05 ` Christoph Lameter
2011-07-06 16:09 ` Michal Nazarewicz
2011-07-06 16:19 ` Christoph Lameter
2011-07-06 17:15 ` Russell King - ARM Linux
2011-07-06 19:03 ` Christoph Lameter
2011-07-06 17:02 ` Russell King - ARM Linux
2011-07-06 16:31 ` Arnd Bergmann
2011-07-06 19:10 ` Nicolas Pitre
2011-07-06 20:23 ` [Linaro-mm-sig] " Arnd Bergmann
2011-07-07 5:29 ` Nicolas Pitre
2011-07-06 14:56 ` Marek Szyprowski
2011-07-06 15:37 ` Russell King - ARM Linux
2011-07-06 15:47 ` 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 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 11:51 ` Arnd Bergmann
2011-07-05 12:07 ` [PATCHv11 0/8] Contiguous Memory Allocator Arnd Bergmann
2011-07-05 12:28 ` Russell King - ARM Linux
2011-07-06 22:11 ` Andrew Morton
2011-07-07 7:36 ` Arnd Bergmann
2011-07-11 13:24 ` Marek Szyprowski
2011-07-20 8:57 [PATCHv12 " Marek Szyprowski
2011-07-20 8:57 ` [PATCH 4/8] mm: MIGRATE_CMA migration type added Marek Szyprowski
2011-08-19 14:27 [PATCHv15 0/8] Contiguous Memory Allocator Marek Szyprowski
2011-08-19 14:27 ` [PATCH 4/8] mm: MIGRATE_CMA migration type added 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=201107051344.31298.arnd@arndb.de \
--to=arnd@arndb.de \
--cc=akpm@linux-foundation.org \
--cc=ankita@in.ibm.com \
--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=m.szyprowski@samsung.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox