From: Joonsoo Kim <iamjoonsoo.kim@lge.com>
To: Vlastimil Babka <vbabka@suse.cz>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Michal Nazarewicz <mina86@mina86.com>,
Minchan Kim <minchan@kernel.org>,
David Rientjes <rientjes@google.com>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/3] mm/cma: always check which page cause allocation failure
Date: Wed, 25 Nov 2015 11:39:14 +0900 [thread overview]
Message-ID: <20151125023913.GA9563@js1304-P5Q-DELUXE> (raw)
In-Reply-To: <565481FC.4090500@suse.cz>
On Tue, Nov 24, 2015 at 04:27:56PM +0100, Vlastimil Babka wrote:
> On 11/13/2015 03:23 AM, Joonsoo Kim wrote:
> >Now, we have tracepoint in test_pages_isolated() to notify
> >pfn which cannot be isolated. But, in alloc_contig_range(),
> >some error path doesn't call test_pages_isolated() so it's still
> >hard to know exact pfn that causes allocation failure.
> >
> >This patch change this situation by calling test_pages_isolated()
> >in almost error path. In allocation failure case, some overhead
> >is added by this change, but, allocation failure is really rare
> >event so it would not matter.
> >
> >In fatal signal pending case, we don't call test_pages_isolated()
> >because this failure is intentional one.
> >
> >Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>
> >---
> > mm/page_alloc.c | 10 +++++++---
> > 1 file changed, 7 insertions(+), 3 deletions(-)
> >
> >diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> >index d89960d..e78d78f 100644
> >--- a/mm/page_alloc.c
> >+++ b/mm/page_alloc.c
> >@@ -6756,8 +6756,12 @@ int alloc_contig_range(unsigned long start, unsigned long end,
> > if (ret)
> > return ret;
> >
> >+ /*
> >+ * In case of -EBUSY, we'd like to know which page causes problem.
> >+ * So, just fall through. We will check it in test_pages_isolated().
> >+ */
> > ret = __alloc_contig_migrate_range(&cc, start, end);
> >- if (ret)
> >+ if (ret && ret != -EBUSY)
> > goto done;
> >
> > /*
> >@@ -6784,8 +6788,8 @@ int alloc_contig_range(unsigned long start, unsigned long end,
> > outer_start = start;
> > while (!PageBuddy(pfn_to_page(outer_start))) {
> > if (++order >= MAX_ORDER) {
> >- ret = -EBUSY;
> >- goto done;
> >+ outer_start = start;
> >+ break;
> > }
> > outer_start &= ~0UL << order;
> > }
>
> Ugh isn't this crazy loop broken? Shouldn't it test that the buddy
> it finds has order high enough? e.g.:
> buddy = pfn_to_page(outer_start)
> outer_start + (1UL << page_order(buddy)) > start
>
> Otherwise you might end up with something like:
> - at "start" there's a page that CMA failed to freed
> - at "start-1" there's another non-buddy page
> - at "start-3" there's an order-1 buddy, so you set outer_start to start-3
> - test_pages_isolated() will complain (via the new tracepoint) about
> pfn of start-1, but actually you would like it to complain about pfn
> of "start"?
>
> So the loop has been broken before your patch, but it didn't matter,
> just potentially wasted some time by picking bogus outer_start. But
> now your tracepoint will give you weird results.
Good catch. I will fix it.
Thanks.
--
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/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2015-11-25 2:38 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-13 2:23 [PATCH 1/3] mm/page_isolation: return last tested pfn rather than failure indicator Joonsoo Kim
2015-11-13 2:23 ` [PATCH 2/3] mm/page_isolation: add new tracepoint, test_pages_isolated Joonsoo Kim
2015-11-13 22:51 ` David Rientjes
2015-11-19 23:34 ` Andrew Morton
2015-11-20 6:21 ` Joonsoo Kim
2015-11-24 14:57 ` Vlastimil Babka
2015-11-13 2:23 ` [PATCH 3/3] mm/cma: always check which page cause allocation failure Joonsoo Kim
2015-11-24 15:27 ` Vlastimil Babka
2015-11-25 2:39 ` Joonsoo Kim [this message]
2015-11-25 5:32 ` [PATCH v2] " Joonsoo Kim
2015-11-25 10:45 ` Vlastimil Babka
2015-11-24 14:57 ` [PATCH 1/3] mm/page_isolation: return last tested pfn rather than failure indicator Vlastimil Babka
-- strict thread matches above, loose matches on Subject: below --
2015-11-09 7:24 Joonsoo Kim
2015-11-09 7:24 ` [PATCH 3/3] mm/cma: always check which page cause allocation failure Joonsoo Kim
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=20151125023913.GA9563@js1304-P5Q-DELUXE \
--to=iamjoonsoo.kim@lge.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mina86@mina86.com \
--cc=minchan@kernel.org \
--cc=rientjes@google.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