linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Scott Wood <scottwood@freescale.com>
To: Laura Abbott <labbott@redhat.com>
Cc: Zhao Qiang <B45475@freescale.com>, <lauraa@codeaurora.org>,
	<linux-kernel@vger.kernel.org>, <linuxppc-dev@lists.ozlabs.org>,
	<akpm@linux-foundation.org>, <olof@lixom.net>,
	<catalin.marinas@arm.com>, <X.xie@freescale.com>
Subject: Re: [RFC] genalloc:add an gen_pool_alloc_align func to genalloc
Date: Thu, 9 Jul 2015 17:17:02 -0500	[thread overview]
Message-ID: <1436480222.2658.151.camel@freescale.com> (raw)
In-Reply-To: <559EECCF.6060702@redhat.com>

On Thu, 2015-07-09 at 14:51 -0700, Laura Abbott wrote:
> On 07/09/2015 12:47 AM, Zhao Qiang wrote:
> > Bytes alignment is required to manage some special ram,
> > so add gen_pool_alloc_align func to genalloc.
> > rename gen_pool_alloc to gen_pool_alloc_align with a align parameter,
> > then provide gen_pool_alloc to call gen_pool_alloc_align with
> > align = 1 Byte.
> > 
> > Signed-off-by: Zhao Qiang <B45475@freescale.com>
> > ---
> > FSL's IP block QE require this function to manage muram.
> > QE supported only PowerPC, and its code was put under arch/powerpc 
> > directory,
> > using arch/powerpc/lib/rheap.c to manage muram.
> > Now it support both arm(ls1021,ls1043,ls2085 and such on) and powerpc,
> > the code need to move from arch/powerpc to public direcory,
> > Scott wood hopes to use genalloc to manage the muram, after discussing
> > with scott, we decide to add gen_pool_alloc_align to meet the requirement
> > for bytes-alignment.
> 
> gen_pool supports custom allocation algorithms. I thought this was discussed
> previously and the conclusion was that if you wanted alignment you should
> use custom allocation algorithms. I'm failing at finding any thread 
> discussing it though.

I hope that by "custom algorithm" you don't mean something implemented 
outside lib/genalloc.c, as this does not seem like such a specialized 
requirement that everyone must reimplement it separately.

> Perhaps another option would be to add another runtime argument to gen_pool
> where you could pass the alignment to your custom allocation function. This
> way alignment isn't inherently coded into any of the algorithms.

That wouldn't let the alignment change for each allocation (and could already 
be done with pool->data).  I suppose one could call get_pool_set_algo() with 
different data (or modify the memory that pool->data is already pointing to) 
before each allocation, but that's a bit clunky...  If making alignment part 
of the mainstream flow is undesired for some reason, how about a 
gen_pool_alloc_data() that lets it be passed in per-allocation (with 
gen_pool_alloc() being a wrapper that passes in pool->data)?

Yes, I know, we could do it in a wrapper (like cpm_muram_alloc() 
unnecessarily does), but why not make the interface better match the way it's 
used?

-Scott

  reply	other threads:[~2015-07-09 22:18 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-09  7:47 [RFC] genalloc:add an gen_pool_alloc_align func to genalloc Zhao Qiang
2015-07-09 21:51 ` Laura Abbott
2015-07-09 22:17   ` Scott Wood [this message]
2015-07-09 22:38     ` Laura Abbott
2015-07-13  2:22   ` Zhao Qiang
2015-07-13 18:42     ` Laura Abbott
2015-07-09 22:19 ` Scott Wood
2015-07-10  5:28   ` Zhao Qiang

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=1436480222.2658.151.camel@freescale.com \
    --to=scottwood@freescale.com \
    --cc=B45475@freescale.com \
    --cc=X.xie@freescale.com \
    --cc=akpm@linux-foundation.org \
    --cc=catalin.marinas@arm.com \
    --cc=labbott@redhat.com \
    --cc=lauraa@codeaurora.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=olof@lixom.net \
    /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).