From: John Stultz <john.stultz@linaro.org>
To: Minchan Kim <minchan@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
LKML <linux-kernel@vger.kernel.org>,
linux-mm <linux-mm@kvack.org>, Hyesoo Yu <hyesoo.yu@samsung.com>,
Matthew Wilcox <willy@infradead.org>,
david@redhat.com, iamjoonsoo.kim@lge.com, vbabka@suse.cz,
Suren Baghdasaryan <surenb@google.com>,
KyongHo Cho <pullip.cho@samsung.com>,
John Dias <joaodias@google.com>,
Hridya Valsaraju <hridya@google.com>,
Sumit Semwal <sumit.semwal@linaro.org>,
Brian Starkey <Brian.Starkey@arm.com>,
linux-media <linux-media@vger.kernel.org>,
"open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS"
<devicetree@vger.kernel.org>, Rob Herring <robh@kernel.org>,
Christian Koenig <christian.koenig@amd.com>,
"moderated list:DMA BUFFER SHARING FRAMEWORK"
<linaro-mm-sig@lists.linaro.org>
Subject: Re: [PATCH v2 4/4] dma-buf: heaps: add chunk heap to dmabuf heaps
Date: Tue, 1 Dec 2020 16:33:14 -0800 [thread overview]
Message-ID: <CALAqxLVBRPOCwLU1iY44Nh1-SpDpsfMz+2c1XRX2WofkpjrhcQ@mail.gmail.com> (raw)
In-Reply-To: <20201202001302.GB3968963@google.com>
On Tue, Dec 1, 2020 at 4:13 PM Minchan Kim <minchan@kernel.org> wrote:
>
> On Tue, Dec 01, 2020 at 03:38:14PM -0800, John Stultz wrote:
> > On Tue, Dec 1, 2020 at 2:55 PM Minchan Kim <minchan@kernel.org> wrote:
> > > On Tue, Dec 01, 2020 at 11:48:15AM -0800, John Stultz wrote:
> > > > On Tue, Dec 1, 2020 at 9:51 AM Minchan Kim <minchan@kernel.org> wrote:
> > > >
> > > > Thanks for reworking and resending this!
> > > >
> > > > ...
> > > > > +static int __init chunk_heap_init(void)
> > > > > +{
> > > > > + struct cma *default_cma = dev_get_cma_area(NULL);
> > > > > + struct dma_heap_export_info exp_info;
> > > > > + struct chunk_heap *chunk_heap;
> > > > > +
> > > > > + if (!default_cma)
> > > > > + return 0;
> > > > > +
> > > > > + chunk_heap = kzalloc(sizeof(*chunk_heap), GFP_KERNEL);
> > > > > + if (!chunk_heap)
> > > > > + return -ENOMEM;
> > > > > +
> > > > > + chunk_heap->order = CHUNK_HEAP_ORDER;
> > > > > + chunk_heap->cma = default_cma;
> > > > > +
> > > > > + exp_info.name = cma_get_name(default_cma);
> > > >
> > > > So, this would create a chunk heap name with the default CMA name,
> > > > which would be indistinguishable from the heap name used for the plain
> > > > CMA heap.
> > > >
> > > > Probably a good idea to prefix it with "chunk-" so the heap device
> > > > names are unique?
> > >
> > > That will give an impression to user that they are using different CMA
> > > area but that's not true. IMHO, let's be honest at this moment.
> >
> > I disagree. The dmabuf heaps provide an abstraction for allocating a
> > type of memory, and while your heap is pulling from CMA, you aren't
> > "just" allocating CMA as the existing CMA heap would suffice for that.
> >
> > Since you need a slightly different method to allocate high order
> > pages in bulk, we really should have a unique way to name the
> > allocator interface. That's why I'd suggest the "chunk-" prefix to the
> > heap name.
>
> Got it. How about this?
>
> diff --git a/drivers/dma-buf/heaps/chunk_heap.c b/drivers/dma-buf/heaps/chunk_heap.c
> index 0277707a93a9..36e189d0b73d 100644
> --- a/drivers/dma-buf/heaps/chunk_heap.c
> +++ b/drivers/dma-buf/heaps/chunk_heap.c
> @@ -410,7 +410,7 @@ static int __init chunk_heap_init(void)
> chunk_heap->order = CHUNK_HEAP_ORDER;
> chunk_heap->cma = default_cma;
>
> - exp_info.name = cma_get_name(default_cma);
> + exp_info.name = "cma-chunk-heap";
That's still a bit general for the default cma (which can be named
differently). I think including cma name is important, just adding the
chunk prefix might be best.
So something like
sprintf(buf, "chunk-%s", cma_get_name(default_cma));
exp_info.name = buf;
thanks
-john
next prev parent reply other threads:[~2020-12-02 0:34 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-01 17:51 [PATCH v2 0/4] Chunk Heap Support on DMA-HEAP Minchan Kim
2020-12-01 17:51 ` [PATCH v2 1/4] mm: introduce alloc_contig_mode Minchan Kim
2020-12-01 17:51 ` [PATCH v2 2/4] mm: introduce cma_alloc_bulk API Minchan Kim
2020-12-02 9:14 ` David Hildenbrand
2020-12-02 15:49 ` Michal Hocko
2020-12-02 16:00 ` David Hildenbrand
2020-12-02 16:15 ` Minchan Kim
2020-12-02 16:48 ` Michal Hocko
2020-12-02 17:54 ` Minchan Kim
2020-12-02 18:51 ` Michal Hocko
2020-12-02 19:26 ` Minchan Kim
2020-12-02 20:22 ` David Hildenbrand
2020-12-02 20:48 ` Minchan Kim
2020-12-03 8:28 ` Michal Hocko
2020-12-03 9:47 ` David Hildenbrand
2020-12-03 11:47 ` Michal Hocko
2020-12-03 11:57 ` David Hildenbrand
2020-12-02 16:00 ` Minchan Kim
2020-12-01 17:51 ` [PATCH v2 3/4] dma-buf: add export symbol for dma-heap Minchan Kim
2020-12-02 13:51 ` Christoph Hellwig
2020-12-01 17:51 ` [PATCH v2 4/4] dma-buf: heaps: add chunk heap to dmabuf heaps Minchan Kim
2020-12-01 19:48 ` John Stultz
2020-12-01 22:55 ` Minchan Kim
2020-12-01 23:38 ` John Stultz
2020-12-02 0:13 ` Minchan Kim
2020-12-02 0:33 ` John Stultz [this message]
2020-12-02 0:57 ` Minchan Kim
2020-12-02 13:54 ` Christoph Hellwig
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=CALAqxLVBRPOCwLU1iY44Nh1-SpDpsfMz+2c1XRX2WofkpjrhcQ@mail.gmail.com \
--to=john.stultz@linaro.org \
--cc=Brian.Starkey@arm.com \
--cc=akpm@linux-foundation.org \
--cc=christian.koenig@amd.com \
--cc=david@redhat.com \
--cc=devicetree@vger.kernel.org \
--cc=hridya@google.com \
--cc=hyesoo.yu@samsung.com \
--cc=iamjoonsoo.kim@lge.com \
--cc=joaodias@google.com \
--cc=linaro-mm-sig@lists.linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=minchan@kernel.org \
--cc=pullip.cho@samsung.com \
--cc=robh@kernel.org \
--cc=sumit.semwal@linaro.org \
--cc=surenb@google.com \
--cc=vbabka@suse.cz \
--cc=willy@infradead.org \
/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).