From: Gregory Fong <gregory.0xf0@gmail.com>
To: Doug Berger <opendmb@gmail.com>
Cc: Angus Clark <angus@angusclark.org>,
Andrew Morton <akpm@linux-foundation.org>,
Laura Abbott <labbott@redhat.com>,
Vlastimil Babka <vbabka@suse.cz>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Lucas Stach <l.stach@pengutronix.de>,
Catalin Marinas <catalin.marinas@arm.com>,
Shiraz Hashim <shashim@codeaurora.org>,
Jaewon Kim <jaewon31.kim@samsung.com>,
"open list:MEMORY MANAGEMENT" <linux-mm@kvack.org>,
open list <linux-kernel@vger.kernel.org>,
Danesh Petigara <dpetigara@broadcom.com>
Subject: Re: [PATCH] cma: fix calculation of aligned offset
Date: Wed, 28 Jun 2017 23:23:52 -0700 [thread overview]
Message-ID: <CADtm3G6EWr6O5TEpXr_EUGA6_Fg7yBm12ttfXfC_EtQT7gyXFw@mail.gmail.com> (raw)
In-Reply-To: <20170628170742.2895-1-opendmb@gmail.com>
On Wed, Jun 28, 2017 at 10:07 AM, Doug Berger <opendmb@gmail.com> wrote:
> The align_offset parameter is used by bitmap_find_next_zero_area_off()
> to represent the offset of map's base from the previous alignment
> boundary; the function ensures that the returned index, plus the
> align_offset, honors the specified align_mask.
>
> The logic introduced by commit b5be83e308f7 ("mm: cma: align to
> physical address, not CMA region position") has the cma driver
> calculate the offset to the *next* alignment boundary.
Wow, I had that completely backward, nice catch.
> In most cases,
> the base alignment is greater than that specified when making
> allocations, resulting in a zero offset whether we align up or down.
> In the example given with the commit, the base alignment (8MB) was
> half the requested alignment (16MB) so the math also happened to work
> since the offset is 8MB in both directions. However, when requesting
> allocations with an alignment greater than twice that of the base,
> the returned index would not be correctly aligned.
It may be worth explaining what impact incorrect alignment has for an
end user, then considering for inclusion in stable.
>
> Also, the align_order arguments of cma_bitmap_aligned_mask() and
> cma_bitmap_aligned_offset() should not be negative so the argument
> type was made unsigned.
>
> Fixes: b5be83e308f7 ("mm: cma: align to physical address, not CMA region position")
> Signed-off-by: Angus Clark <angus@angusclark.org>
> Signed-off-by: Doug Berger <opendmb@gmail.com>
Acked-by: Gregory Fong <gregory.0xf0@gmail.com>
next prev parent reply other threads:[~2017-06-29 6:24 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-28 17:07 [PATCH] cma: fix calculation of aligned offset Doug Berger
2017-06-29 6:23 ` Gregory Fong [this message]
2017-06-29 16:54 ` Doug Berger
2017-06-29 20:48 ` Andrew Morton
2017-06-30 0:43 ` Doug Berger
2017-06-30 0:49 ` Andrew Morton
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=CADtm3G6EWr6O5TEpXr_EUGA6_Fg7yBm12ttfXfC_EtQT7gyXFw@mail.gmail.com \
--to=gregory.0xf0@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=angus@angusclark.org \
--cc=catalin.marinas@arm.com \
--cc=dpetigara@broadcom.com \
--cc=gregkh@linuxfoundation.org \
--cc=jaewon31.kim@samsung.com \
--cc=l.stach@pengutronix.de \
--cc=labbott@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=opendmb@gmail.com \
--cc=shashim@codeaurora.org \
--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;
as well as URLs for NNTP newsgroup(s).