From: Gregory Fong <gregory.0xf0@gmail.com>
To: Michal Nazarewicz <mina86@mina86.com>
Cc: linux-mm@kvack.org, Laura Abbott <lauraa@codeaurora.org>,
iamjoonsoo.kim@lge.com,
Marek Szyprowski <m.szyprowski@samsung.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Florian Fainelli <f.fainelli@gmail.com>,
Brian Norris <computersforpeace@gmail.com>
Subject: Re: CMA alignment question
Date: Tue, 4 Nov 2014 20:18:58 -0800 [thread overview]
Message-ID: <CADtm3G7bU6Y2aKco5Vb81KSqsy=FH9zmdDJm=Tixjoep1YeJ7Q@mail.gmail.com> (raw)
In-Reply-To: <xa1tlhnq7ga7.fsf@mina86.com>
On Tue, Nov 4, 2014 at 2:27 PM, Michal Nazarewicz <mina86@mina86.com> wrote:
> On Tue, Nov 04 2014, Gregory Fong wrote:
>> The alignment in cma_alloc() is done w.r.t. the bitmap. This is a
>> problem when, for example:
>>
>> - a device requires 16M (order 12) alignment
>> - the CMA region is not 16 M aligned
>>
>> In such a case, can result with the CMA region starting at, say,
>> 0x2f800000 but any allocation you make from there will be aligned from
>> there. Requesting an allocation of 32 M with 16 M alignment, will
>> result in an allocation from 0x2f800000 to 0x31800000, which doesn't
>> work very well if your strange device requires 16M alignment.
>>
>> This doesn't have the behavior I would expect, which would be for the
>> allocation to be aligned w.r.t. the start of memory. I realize that
>> aligning the CMA region is an option, but don't see why cma_alloc()
>> aligns to the start of the CMA region. Is there a good reason for
>> having cma_alloc() alignment work this way?
>
> No, it's a bug. The alignment should indicate alignment of physical
> address not position in CMA region.
>
Ah, now I see that Marek submitted this patch from you back in 2011
that would have allowed the bitmap lib to support an alignment offset:
http://thread.gmane.org/gmane.linux.kernel/1121103/focus=1121100
Any idea why this didn't make it into the later changesets? If not,
I'll resubmit it and to use it to fix this bug.
Thanks,
Gregory
--
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:[~2014-11-05 4:19 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-04 21:03 Gregory Fong
2014-11-04 22:27 ` Michal Nazarewicz
2014-11-05 4:18 ` Gregory Fong [this message]
2014-11-05 7:20 ` Weijie Yang
2014-11-05 22:01 ` Michal Nazarewicz
2014-11-06 1:00 ` Weijie Yang
2014-11-06 12:29 ` Michal 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='CADtm3G7bU6Y2aKco5Vb81KSqsy=FH9zmdDJm=Tixjoep1YeJ7Q@mail.gmail.com' \
--to=gregory.0xf0@gmail.com \
--cc=computersforpeace@gmail.com \
--cc=f.fainelli@gmail.com \
--cc=iamjoonsoo.kim@lge.com \
--cc=lauraa@codeaurora.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=m.szyprowski@samsung.com \
--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