From: Joonsoo Kim <iamjoonsoo.kim@lge.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>,
Marek Szyprowski <m.szyprowski@samsung.com>,
Michal Nazarewicz <mina86@mina86.com>,
Minchan Kim <minchan@kernel.org>,
Russell King - ARM Linux <linux@arm.linux.org.uk>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Paolo Bonzini <pbonzini@redhat.com>,
Gleb Natapov <gleb@kernel.org>, Alexander Graf <agraf@suse.de>,
Benjamin Herrenschmidt <benh@kernel.crashing.org>,
Paul Mackerras <paulus@samba.org>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org,
kvm-ppc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
Zhang Yanfei <zhangyanfei@cn.fujitsu.com>
Subject: Re: [PATCH v3 -next 4/9] DMA, CMA: support arbitrary bitmap granularity
Date: Thu, 19 Jun 2014 17:18:07 +0900 [thread overview]
Message-ID: <20140619081807.GA28611@js1304-P5Q-DELUXE> (raw)
In-Reply-To: <20140618134815.69c4d0a5f916846f9857e9ff@linux-foundation.org>
On Wed, Jun 18, 2014 at 01:48:15PM -0700, Andrew Morton wrote:
> On Mon, 16 Jun 2014 14:40:46 +0900 Joonsoo Kim <iamjoonsoo.kim@lge.com> wrote:
>
> > PPC KVM's CMA area management requires arbitrary bitmap granularity,
> > since they want to reserve very large memory and manage this region
> > with bitmap that one bit for several pages to reduce management overheads.
> > So support arbitrary bitmap granularity for following generalization.
> >
> > ...
> >
> > --- a/drivers/base/dma-contiguous.c
> > +++ b/drivers/base/dma-contiguous.c
> > @@ -38,6 +38,7 @@ struct cma {
> > unsigned long base_pfn;
> > unsigned long count;
> > unsigned long *bitmap;
> > + unsigned int order_per_bit; /* Order of pages represented by one bit */
> > struct mutex lock;
> > };
> >
> > @@ -157,9 +158,37 @@ void __init dma_contiguous_reserve(phys_addr_t limit)
> >
> > static DEFINE_MUTEX(cma_mutex);
> >
> > +static unsigned long cma_bitmap_aligned_mask(struct cma *cma, int align_order)
> > +{
> > + return (1 << (align_order >> cma->order_per_bit)) - 1;
> > +}
>
> Might want a "1UL << ..." here.
Okay!
>
> > +static unsigned long cma_bitmap_maxno(struct cma *cma)
> > +{
> > + return cma->count >> cma->order_per_bit;
> > +}
> > +
> > +static unsigned long cma_bitmap_pages_to_bits(struct cma *cma,
> > + unsigned long pages)
> > +{
> > + return ALIGN(pages, 1 << cma->order_per_bit) >> cma->order_per_bit;
> > +}
>
> Ditto. I'm not really sure what the compiler will do in these cases,
> but would prefer not to rely on it anyway!
Okay!
Thanks for fix!
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2014-06-19 8:13 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-16 5:40 [PATCH v3 -next 0/9] CMA: generalize CMA reserved area management code Joonsoo Kim
2014-06-16 5:40 ` [PATCH v3 -next 1/9] DMA, CMA: fix possible memory leak Joonsoo Kim
2014-06-16 6:27 ` Minchan Kim
2014-06-17 1:33 ` Joonsoo Kim
2014-06-16 5:40 ` [PATCH v3 -next 2/9] DMA, CMA: separate core CMA management codes from DMA APIs Joonsoo Kim
2014-06-16 5:40 ` [PATCH v3 -next 3/9] DMA, CMA: support alignment constraint on CMA region Joonsoo Kim
2014-06-16 5:40 ` [PATCH v3 -next 4/9] DMA, CMA: support arbitrary bitmap granularity Joonsoo Kim
2014-06-18 20:48 ` Andrew Morton
2014-06-19 8:18 ` Joonsoo Kim [this message]
2014-06-16 5:40 ` [PATCH v3 -next 5/9] CMA: generalize CMA reserved area management functionality Joonsoo Kim
2014-07-17 8:52 ` Marek Szyprowski
2014-07-17 9:36 ` [PATCH] CMA: generalize CMA reserved area management functionality (fixup) Marek Szyprowski
2014-07-17 22:06 ` Andrew Morton
2014-07-18 7:33 ` Marek Szyprowski
2014-06-16 5:40 ` [PATCH v3 -next 6/9] PPC, KVM, CMA: use general CMA reserved area management framework Joonsoo Kim
2014-06-16 5:40 ` [PATCH v3 -next 7/9] mm, CMA: clean-up CMA allocation error path Joonsoo Kim
2014-06-16 5:40 ` [PATCH v3 -next 8/9] mm, CMA: change cma_declare_contiguous() to obey coding convention Joonsoo Kim
2014-06-16 5:40 ` [PATCH v3 -next 9/9] mm, CMA: clean-up log message Joonsoo Kim
2014-06-16 9:11 ` [PATCH v3 -next 0/9] CMA: generalize CMA reserved area management code Marek Szyprowski
2014-06-17 1:25 ` Joonsoo Kim
2014-06-18 20:51 ` Andrew Morton
2014-06-24 7:52 ` Joonsoo Kim
2014-06-25 12:33 ` Marek Szyprowski
2014-06-25 20:04 ` 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=20140619081807.GA28611@js1304-P5Q-DELUXE \
--to=iamjoonsoo.kim@lge.com \
--cc=agraf@suse.de \
--cc=akpm@linux-foundation.org \
--cc=aneesh.kumar@linux.vnet.ibm.com \
--cc=benh@kernel.crashing.org \
--cc=gleb@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=kvm-ppc@vger.kernel.org \
--cc=kvm@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux@arm.linux.org.uk \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=m.szyprowski@samsung.com \
--cc=mina86@mina86.com \
--cc=minchan@kernel.org \
--cc=paulus@samba.org \
--cc=pbonzini@redhat.com \
--cc=zhangyanfei@cn.fujitsu.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