Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1677432
| From | Gregory Fong <gregory.0xf0@gmail.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] cma: fix calculation of aligned offset |
| Date | 2017-06-29 08:30 +0200 |
| Message-ID | <tXB7H-44d-7@gated-at.bofh.it> (permalink) |
| References | <tXpq2-t5-155@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
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>
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH] cma: fix calculation of aligned offset Doug Berger <opendmb@gmail.com> - 2017-06-28 20:00 +0200
Re: [PATCH] cma: fix calculation of aligned offset Gregory Fong <gregory.0xf0@gmail.com> - 2017-06-29 08:30 +0200
Re: [PATCH] cma: fix calculation of aligned offset Doug Berger <opendmb@gmail.com> - 2017-06-29 19:00 +0200
Re: [PATCH] cma: fix calculation of aligned offset Andrew Morton <akpm@linux-foundation.org> - 2017-06-29 22:50 +0200
Re: [PATCH] cma: fix calculation of aligned offset Andrew Morton <akpm@linux-foundation.org> - 2017-06-30 02:50 +0200
Re: [PATCH] cma: fix calculation of aligned offset Doug Berger <opendmb@gmail.com> - 2017-06-30 02:50 +0200
csiph-web