Re: [PATCH v10 3/5] CPM/QE: use genalloc to manage CPM/QE muram
From: Scott Wood
Date: Wed Sep 23 2015 - 00:03:13 EST
On Tue, 2015-09-22 at 21:20 -0500, Zhao Qiang-B45475 wrote:
> On Wen, Sep 23, 2015 at 8:19 AM +0800, Wood Scott-B07421 wrote:
>
> > > > > {
> > > > > - int ret;
> > > > > +
> > > > > + unsigned long start;
> > > > > unsigned long flags;
> > > > > + unsigned long size_alloc = size; struct muram_block *entry; int
> > > > > + end_bit; int order = muram_pool->min_alloc_order;
> > > > >
> > > > > spin_lock_irqsave(&cpm_muram_lock, flags);
> > > > > - ret = rh_free(&cpm_muram_info, offset);
> > > > > + end_bit = (offset >> order) + ((size + (1UL << order) - 1) >>
> > > > order);
> > > > > + if ((offset + size) > (end_bit << order))
> > > > > + size_alloc = size + (1UL << order);
> > > >
> > > > Why do you need to do all these calculations here?
> > >
> > > So do it in gen_pool_fixed_alloc?
> >
> > Could you explain why they're needed at all?
>
> Why it does the calculations?
> If the min block of gen_pool is 8 bytes, and I want to allocate a
> Region with offset=7, size=8bytes, I actually need block 0 and block 1,
> And the allocation will give me block 0.
How can you have offset 7 if the minimum order is 2 bytes?
-Scott
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/