From: Oscar Salvador <osalvador@suse.de>
To: Qian Cai <cai@lca.pw>, akpm@linux-foundation.org
Cc: mhocko@suse.com, linux-mm@kvack.org,
linux-kernel@vger.kernel.org, Vlastimil Babka <vbabka@suse.cz>
Subject: Re: [PATCH v4] mm/hotplug: treat CMA pages as unmovable
Date: Wed, 17 Apr 2019 16:06:45 +0200 [thread overview]
Message-ID: <1555510005.3139.36.camel@suse.de> (raw)
In-Reply-To: <20190416170510.20048-1-cai@lca.pw>
> Acked-by: Michal Hocko <mhocko@suse.com>
> Acked-by: Vlastimil Babka <vbabka@suse.cz>
> Signed-off-by: Qian Cai <cai@lca.pw>
Reviewed-by: Oscar Salvador <osalvador@suse.de>
> ---
>
> v4: Use is_migrate_cma_page() and update the commit log per
> Vlastimil.
> v3: Use a string pointer instead of an array per Michal.
> v2: Borrow some commit log texts.
> Call dump_page() in the error path.
>
> mm/page_alloc.c | 30 ++++++++++++++++++------------
> 1 file changed, 18 insertions(+), 12 deletions(-)
>
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index d96ca5bc555b..c6ce20aaf80b 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -8005,7 +8005,10 @@ void *__init alloc_large_system_hash(const
> char *tablename,
> bool has_unmovable_pages(struct zone *zone, struct page *page, int
> count,
> int migratetype, int flags)
> {
> - unsigned long pfn, iter, found;
> + unsigned long found;
> + unsigned long iter = 0;
> + unsigned long pfn = page_to_pfn(page);
> + const char *reason = "unmovable page";
>
> /*
> * TODO we could make this much more efficient by not
> checking every
> @@ -8015,17 +8018,20 @@ bool has_unmovable_pages(struct zone *zone,
> struct page *page, int count,
> * can still lead to having bootmem allocations in
> zone_movable.
> */
>
> - /*
> - * CMA allocations (alloc_contig_range) really need to mark
> isolate
> - * CMA pageblocks even when they are not movable in fact so
> consider
> - * them movable here.
> - */
> - if (is_migrate_cma(migratetype) &&
> - is_migrate_cma(get_pageblock_migratetype(pag
> e)))
> - return false;
> + if (is_migrate_cma_page(page)) {
> + /*
> + * CMA allocations (alloc_contig_range) really need
> to mark
> + * isolate CMA pageblocks even when they are not
> movable in fact
> + * so consider them movable here.
> + */
> + if (is_migrate_cma(migratetype))
> + return false;
> +
> + reason = "CMA page";
> + goto unmovable;
> + }
>
> - pfn = page_to_pfn(page);
> - for (found = 0, iter = 0; iter < pageblock_nr_pages; iter++)
> {
> + for (found = 0; iter < pageblock_nr_pages; iter++) {
> unsigned long check = pfn + iter;
>
> if (!pfn_valid_within(check))
> @@ -8105,7 +8111,7 @@ bool has_unmovable_pages(struct zone *zone,
> struct page *page, int count,
> unmovable:
> WARN_ON_ONCE(zone_idx(zone) == ZONE_MOVABLE);
> if (flags & REPORT_FAILURE)
> - dump_page(pfn_to_page(pfn+iter), "unmovable page");
> + dump_page(pfn_to_page(pfn + iter), reason);
> return true;
> }
>
--
Oscar Salvador
SUSE L3
prev parent reply other threads:[~2019-04-17 14:07 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-16 17:05 Qian Cai
2019-04-17 14:06 ` Oscar Salvador [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=1555510005.3139.36.camel@suse.de \
--to=osalvador@suse.de \
--cc=akpm@linux-foundation.org \
--cc=cai@lca.pw \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@suse.com \
--cc=vbabka@suse.cz \
/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