From: Laura Abbott <labbott@redhat.com>
To: "Michał Nazarewicz" <mina86@mina86.com>
Cc: Weijie Yang <weijie.yang@samsung.com>,
iamjoonsoo.kim@lge.com,
Marek Szyprowski <m.szyprowski@samsung.com>,
Andrew Morton <akpm@linux-foundation.org>,
Weijie Yang <weijie.yang.kh@gmail.com>,
"linux-mm@kvack.org" <linux-mm@kvack.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] cma: allow concurrent cma pages allocation for multi-cma areas
Date: Fri, 05 Jun 2015 10:42:52 -0700 [thread overview]
Message-ID: <5571DF9C.4030404@redhat.com> (raw)
In-Reply-To: <CA+pa1O2xTnWdP6bbPNnBM=P2oMAaLJf9hWZd+KOL12BJp4R-3Q@mail.gmail.com>
On 06/05/2015 10:19 AM, MichaA? Nazarewicz wrote:
> On Fri, Jun 05 2015, Laura Abbott wrote:
>> On 06/05/2015 01:01 AM, Weijie Yang wrote:
>>> Currently we have to hold the single cma_mutex when alloc cma pages,
>>> it is ok when there is only one cma area in system.
>>> However, when there are several cma areas, such as in our Android smart
>>> phone, the single cma_mutex prevents concurrent cma page allocation.
>>>
>>> This patch removes the single cma_mutex and uses per-cma area alloc_lock,
>>> this allows concurrent cma pages allocation for different cma areas while
>>> protects access to the same pageblocks.
>>>
>>> Signed-off-by: Weijie Yang <weijie.yang@samsung.com>
>
>> Last I knew alloc_contig_range needed to be serialized which is why we
>> still had the global CMA mutex. https://lkml.org/lkml/2014/2/18/462
>>
>> So NAK unless something has changed to allow this.
>
> This patch should be fine.
>
> Change youa??ve pointed to would get rid of any serialisation around
> alloc_contig_range which is dangerous, but since CMA regions are
> pageblock-aligned:
>
> /*
> * Sanitise input arguments.
> * Pages both ends in CMA area could be merged into adjacent unmovable
> * migratetype page by page allocator's buddy algorithm. In the case,
> * you couldn't get a contiguous memory, which is not what we want.
> */
> alignment = max(alignment,
> (phys_addr_t)PAGE_SIZE << max(MAX_ORDER - 1, pageblock_order));
> base = ALIGN(base, alignment);
> size = ALIGN(size, alignment);
> limit &= ~(alignment - 1);
>
> synchronising allocation in each area should work fine.
>
Okay yes, you are correct. I was somehow thinking that different CMA regions
could end up in the same pageblock. This is documented in alloc_contig_range
but can we put a comment explaining this here too? It seems to come up
every time locking here is discussed.
Thanks,
Laura
--
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>
WARNING: multiple messages have this Message-ID (diff)
From: Laura Abbott <labbott@redhat.com>
To: "Michał Nazarewicz" <mina86@mina86.com>
Cc: Weijie Yang <weijie.yang@samsung.com>,
iamjoonsoo.kim@lge.com,
Marek Szyprowski <m.szyprowski@samsung.com>,
Andrew Morton <akpm@linux-foundation.org>,
Weijie Yang <weijie.yang.kh@gmail.com>,
"linux-mm@kvack.org" <linux-mm@kvack.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] cma: allow concurrent cma pages allocation for multi-cma areas
Date: Fri, 05 Jun 2015 10:42:52 -0700 [thread overview]
Message-ID: <5571DF9C.4030404@redhat.com> (raw)
In-Reply-To: <CA+pa1O2xTnWdP6bbPNnBM=P2oMAaLJf9hWZd+KOL12BJp4R-3Q@mail.gmail.com>
On 06/05/2015 10:19 AM, Michał Nazarewicz wrote:
> On Fri, Jun 05 2015, Laura Abbott wrote:
>> On 06/05/2015 01:01 AM, Weijie Yang wrote:
>>> Currently we have to hold the single cma_mutex when alloc cma pages,
>>> it is ok when there is only one cma area in system.
>>> However, when there are several cma areas, such as in our Android smart
>>> phone, the single cma_mutex prevents concurrent cma page allocation.
>>>
>>> This patch removes the single cma_mutex and uses per-cma area alloc_lock,
>>> this allows concurrent cma pages allocation for different cma areas while
>>> protects access to the same pageblocks.
>>>
>>> Signed-off-by: Weijie Yang <weijie.yang@samsung.com>
>
>> Last I knew alloc_contig_range needed to be serialized which is why we
>> still had the global CMA mutex. https://lkml.org/lkml/2014/2/18/462
>>
>> So NAK unless something has changed to allow this.
>
> This patch should be fine.
>
> Change you’ve pointed to would get rid of any serialisation around
> alloc_contig_range which is dangerous, but since CMA regions are
> pageblock-aligned:
>
> /*
> * Sanitise input arguments.
> * Pages both ends in CMA area could be merged into adjacent unmovable
> * migratetype page by page allocator's buddy algorithm. In the case,
> * you couldn't get a contiguous memory, which is not what we want.
> */
> alignment = max(alignment,
> (phys_addr_t)PAGE_SIZE << max(MAX_ORDER - 1, pageblock_order));
> base = ALIGN(base, alignment);
> size = ALIGN(size, alignment);
> limit &= ~(alignment - 1);
>
> synchronising allocation in each area should work fine.
>
Okay yes, you are correct. I was somehow thinking that different CMA regions
could end up in the same pageblock. This is documented in alloc_contig_range
but can we put a comment explaining this here too? It seems to come up
every time locking here is discussed.
Thanks,
Laura
next prev parent reply other threads:[~2015-06-05 17:42 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-05 8:01 [PATCH] cma: allow concurrent cma pages allocation for multi-cma areas Weijie Yang
2015-06-05 8:01 ` Weijie Yang
2015-06-05 15:26 ` Laura Abbott
2015-06-05 15:26 ` Laura Abbott
2015-06-05 17:19 ` Michał Nazarewicz
2015-06-05 17:19 ` Michał Nazarewicz
2015-06-05 17:42 ` Laura Abbott [this message]
2015-06-05 17:42 ` Laura Abbott
2015-06-05 20:15 ` Michał Nazarewicz
2015-06-05 20:15 ` Michał Nazarewicz
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=5571DF9C.4030404@redhat.com \
--to=labbott@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=iamjoonsoo.kim@lge.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=m.szyprowski@samsung.com \
--cc=mina86@mina86.com \
--cc=weijie.yang.kh@gmail.com \
--cc=weijie.yang@samsung.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.