From: Andrew Morton <akpm@linux-foundation.org>
To: Alexey Skidanov <alexey.skidanov@intel.com>
Cc: sbates@raithlin.com, logang@deltatee.com, danielmentz@google.com,
mathieu.desnoyers@efficios.com, linux-kernel@vger.kernel.org,
labbott@redhat.com
Subject: Re: [PATCH] lib/genaloc: Fix allocation of aligned buffer from non-aligned chunk
Date: Wed, 7 Nov 2018 14:12:44 -0800 [thread overview]
Message-ID: <20181107141244.624161486d7b187eb02b714a@linux-foundation.org> (raw)
In-Reply-To: <fa2b502b-13a1-2f93-02aa-de1121b6e602@intel.com>
On Wed, 7 Nov 2018 08:27:31 +0200 Alexey Skidanov <alexey.skidanov@intel.com> wrote:
>
>
> On 11/7/18 12:15 AM, Andrew Morton wrote:
> > On Tue, 6 Nov 2018 14:20:53 +0200 Alexey Skidanov <alexey.skidanov@intel.com> wrote:
> >
> >> On success, gen_pool_first_fit_align() returns the bit number such that
> >> chunk_start_addr + (bit << order) is properly aligned. On failure,
> >> the bitmap size parameter is returned.
> >>
> >> When the chunk_start_addr isn't aligned properly, the
> >> chunk_start_addr + (bit << order) isn't aligned too.
> >>
> >> To fix this, gen_pool_first_fit_align() takes into account
> >> the chunk_start_addr alignment and returns the bit value such that
> >> chunk_start_addr + (bit << order) is properly aligned
> >> (exactly as it done in CMA).
> >>
> >> ...
> >>
> >> --- a/include/linux/genalloc.h
> >> +++ b/include/linux/genalloc.h
> >>
> >> ...
> >>
> >> + struct gen_pool *pool, unsigned long start_add)
> >>
> >> ...
> >>
> >> + struct gen_pool *pool, unsigned long start_add)
> >>
> >> ...
> >>
> >> + struct gen_pool *pool, unsigned long start_add)
> >>
> >> ...
> >>
> >
> > We have three typos here. Which makes me wonder why we're passing the
> > new argument and then not using it?
> >
> genpool uses allocation callbacks function that implement some
> allocation strategy - bes fit, first fit, ... All of them has the same
> type. The added chunk start_addr is used only in one of them -
> gen_pool_first_fit_align()
OK, but the argument name here is start_add, not start_addr.
next prev parent reply other threads:[~2018-11-07 22:12 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-06 12:20 Alexey Skidanov
2018-11-06 22:11 ` Andrew Morton
2018-11-07 6:21 ` Alexey Skidanov
2018-11-07 22:14 ` Andrew Morton
2018-11-08 8:58 ` Alexey Skidanov
2018-11-06 22:15 ` Andrew Morton
2018-11-07 6:27 ` Alexey Skidanov
2018-11-07 22:12 ` Andrew Morton [this message]
2018-11-08 8:56 ` Alexey Skidanov
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=20181107141244.624161486d7b187eb02b714a@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=alexey.skidanov@intel.com \
--cc=danielmentz@google.com \
--cc=labbott@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=logang@deltatee.com \
--cc=mathieu.desnoyers@efficios.com \
--cc=sbates@raithlin.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
all inboxes | Powered by JetHome®