From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BEE0AC64E90 for ; Wed, 2 Dec 2020 00:33:28 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 10F6B2223C for ; Wed, 2 Dec 2020 00:33:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 10F6B2223C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id F25D08D0002; Tue, 1 Dec 2020 19:33:26 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id ED6778D0001; Tue, 1 Dec 2020 19:33:26 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DED188D0002; Tue, 1 Dec 2020 19:33:26 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0147.hostedemail.com [216.40.44.147]) by kanga.kvack.org (Postfix) with ESMTP id CA2718D0001 for ; Tue, 1 Dec 2020 19:33:26 -0500 (EST) Received: from smtpin28.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 95BD8181AEF09 for ; Wed, 2 Dec 2020 00:33:26 +0000 (UTC) X-FDA: 77546468412.28.grass69_500e77a273ae Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin28.hostedemail.com (Postfix) with ESMTP id 696C26C16 for ; Wed, 2 Dec 2020 00:33:26 +0000 (UTC) X-HE-Tag: grass69_500e77a273ae X-Filterd-Recvd-Size: 6383 Received: from mail-ot1-f66.google.com (mail-ot1-f66.google.com [209.85.210.66]) by imf49.hostedemail.com (Postfix) with ESMTP for ; Wed, 2 Dec 2020 00:33:25 +0000 (UTC) Received: by mail-ot1-f66.google.com with SMTP id h19so115372otr.1 for ; Tue, 01 Dec 2020 16:33:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=b7bUWtf5JcEJo8eU3QHsT0IzGFGYcNHBefSS0GBzXro=; b=sWXd+SHH1p8PFhqTXQn2a8RJrdStziNkREVVw898XLR9gKhEeG87DKrTaXuBp+hljF Qy5kMm9u47MRVfglN6qahVbyGaqDWcocER3LZMDB+BF15iAozX+4iZyzq8HWMss82MeW NxxBBPGypZ53OxJu8U51Za+0484uvPr1pOX7Qr6OybOtcp7qeqF0Ptqi3KA/4mZqA3Ge 2zwsRfZCpNniu2dG/mXJ6QeLuTf5zzd3dfMwSN0YB36S5UA5maIR0RGJ8L8Xqo4Cm885 WrwMJFXPoyr6GecGPwf4V+0spF0cma8nBl1Z/ezj565VHqu0dLrlFVW+daH9jejsAhfx 6FwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=b7bUWtf5JcEJo8eU3QHsT0IzGFGYcNHBefSS0GBzXro=; b=TPTr4zlb1tPKlemgjOvxgirYt9MLLsAtuyMFfn1iA49sJSLXVG/2U+i+H/5/Czocca Ylu05o8RkgtbE1hMkRa34Bg1ldVOUYV0Eg6LCQyGLnww2tg/I9iiWZhrGlgz7+ZyspUr nkefQZ3O/tDvnbk//LJqF+dUDtsHLb3EW3qdzQI6lTA39VWC/CnH1voFK/yy/pJX78kt nNn/mHXQJARqJgyQ00S68Sniv5q54C1boW0flQUaqmzSQozCThETRh3ACDBcFhULcQzm BTjdQvfPa8aWXm+S+MeEKlqQzNwNHw2P4kAqRaY0Q87NMpQxJuHHPB6IcoAnKjh91T8i UIBQ== X-Gm-Message-State: AOAM532GiS8fyY0hfeQZNZ9QNWgriPBSRKWcn+zqG4Y4ASJl7tqwNI/r 8tPm/efvwIUsGXL+PKwT4fgUP6NqsmM22uB+JHQdvw== X-Google-Smtp-Source: ABdhPJzzD//+z/Kgp4hq35PZtpKGAwVdEzUSs1T/u5eAapNIYsM1KOPDQ3WheaHwILzvturXQdCwoNk4xq6ekztTclc= X-Received: by 2002:a9d:851:: with SMTP id 75mr104253oty.102.1606869205374; Tue, 01 Dec 2020 16:33:25 -0800 (PST) MIME-Version: 1.0 References: <20201201175144.3996569-1-minchan@kernel.org> <20201201175144.3996569-5-minchan@kernel.org> <20201201225554.GA3968963@google.com> <20201202001302.GB3968963@google.com> In-Reply-To: <20201202001302.GB3968963@google.com> From: John Stultz Date: Tue, 1 Dec 2020 16:33:14 -0800 Message-ID: Subject: Re: [PATCH v2 4/4] dma-buf: heaps: add chunk heap to dmabuf heaps To: Minchan Kim Cc: Andrew Morton , LKML , linux-mm , Hyesoo Yu , Matthew Wilcox , david@redhat.com, iamjoonsoo.kim@lge.com, vbabka@suse.cz, Suren Baghdasaryan , KyongHo Cho , John Dias , Hridya Valsaraju , Sumit Semwal , Brian Starkey , linux-media , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , Rob Herring , Christian Koenig , "moderated list:DMA BUFFER SHARING FRAMEWORK" Content-Type: text/plain; charset="UTF-8" X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Tue, Dec 1, 2020 at 4:13 PM Minchan Kim 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 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 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