linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: John Stultz <john.stultz@linaro.org>
To: Hillf Danton <hdanton@sina.com>
Cc: lkml <linux-kernel@vger.kernel.org>,
	Sumit Semwal <sumit.semwal@linaro.org>,
	Liam Mark <lmark@codeaurora.org>,
	Robin Murphy <robin.murphy@arm.com>,
	Ezequiel Garcia <ezequiel@collabora.com>,
	Simon Ser <contact@emersion.fr>, James Jones <jajones@nvidia.com>,
	linux-media <linux-media@vger.kernel.org>,
	dri-devel <dri-devel@lists.freedesktop.org>
Subject: Re: [PATCH v4 5/7] dma-buf: system_heap: Allocate higher order pages if available
Date: Thu, 29 Oct 2020 12:34:51 -0700	[thread overview]
Message-ID: <CALAqxLV8EYq7FEXFGrGnWocpiXihAd+wHcu5=X4oC2oS8_Fy=A@mail.gmail.com> (raw)
In-Reply-To: <20201029070221.2856-1-hdanton@sina.com>

On Thu, Oct 29, 2020 at 12:02 AM Hillf Danton <hdanton@sina.com> wrote:
>
> On Thu, 29 Oct 2020 00:16:22 +0000 John Stultz wrote:
> >
> > +#define HIGH_ORDER_GFP  (((GFP_HIGHUSER | __GFP_ZERO | __GFP_NOWARN \
> > +                             | __GFP_NORETRY) & ~__GFP_RECLAIM) \
> > +                             | __GFP_COMP)
> > +#define LOW_ORDER_GFP (GFP_HIGHUSER | __GFP_ZERO | __GFP_COMP)
> > +static gfp_t order_flags[] = {HIGH_ORDER_GFP, LOW_ORDER_GFP, LOW_ORDER_GFP};
> > +static const unsigned int orders[] = {8, 4, 0};
> > +#define NUM_ORDERS ARRAY_SIZE(orders)
>
> A two-line comment helps much understand the ORDERs above if it specifies the
> reasons behind the detour to HPAGE_PMD_ORDER and PAGE_ALLOC_COSTLY_ORDER.

Thanks so much for the review and feedback!

So yes, this was pulled from ION's system heap:
  https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/staging/android/ion/ion_system_heap.c#n20

But adding __GFP_COMP as that's added by ION in the pagepool code I
didn't include:
  https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/staging/android/ion/ion_page_pool.c#n146

I unfortunately don't have a lot of detail on the exact rationale
(other than what I can pull from the commit log), I suspect it has to
do experiential knowledge of the majority of graphics buffers being
small multiples of 1M or 64K.

But I do agree some rationale in a comment would be helpful, and will
try to add that.

As for your comment on HPAGE_PMD_ORDER (9 on arm64/arm) and
PAGE_ALLOC_COSTLY_ORDER(3), I'm not totally sure I understand your
question? Are you suggesting those values would be more natural orders
to choose from?

Thanks again!
-john

  parent reply	other threads:[~2020-10-29 19:35 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-29  0:16 [RESEND][PATCH v4 0/7] dma-buf: Performance improvements for system heap & a system-uncached implementation John Stultz
2020-10-29  0:16 ` [PATCH v4 1/7] dma-buf: system_heap: Rework system heap to use sgtables instead of pagelists John Stultz
2020-10-29  0:16 ` [PATCH v4 2/7] dma-buf: heaps: Move heap-helper logic into the cma_heap implementation John Stultz
2020-10-29  0:16 ` [PATCH v4 3/7] dma-buf: heaps: Remove heap-helpers code John Stultz
2020-10-29  0:16 ` [PATCH v4 4/7] dma-buf: heaps: Skip sync if not mapped John Stultz
2020-10-29  0:16 ` [PATCH v4 5/7] dma-buf: system_heap: Allocate higher order pages if available John Stultz
     [not found]   ` <20201029070221.2856-1-hdanton@sina.com>
2020-10-29 19:34     ` John Stultz [this message]
2020-10-29  0:16 ` [PATCH v4 6/7] dma-buf: dma-heap: Keep track of the heap device struct John Stultz
2020-10-29  0:16 ` [PATCH v4 7/7] dma-buf: system_heap: Add a system-uncached heap re-using the system heap John Stultz
     [not found]   ` <20201029071037.2913-1-hdanton@sina.com>
2020-10-29 22:28     ` John Stultz
     [not found] <20201030023427.3078-1-hdanton@sina.com>
2020-10-30  3:30 ` [PATCH v4 5/7] dma-buf: system_heap: Allocate higher order pages if available John Stultz
  -- strict thread matches above, loose matches on Subject: below --
2020-10-17  1:32 [PATCH v4 0/7] dma-buf: Performance improvements for system heap & a system-uncached implementation John Stultz
2020-10-17  1:32 ` [PATCH v4 5/7] dma-buf: system_heap: Allocate higher order pages if available John Stultz

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='CALAqxLV8EYq7FEXFGrGnWocpiXihAd+wHcu5=X4oC2oS8_Fy=A@mail.gmail.com' \
    --to=john.stultz@linaro.org \
    --cc=contact@emersion.fr \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=ezequiel@collabora.com \
    --cc=hdanton@sina.com \
    --cc=jajones@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=lmark@codeaurora.org \
    --cc=robin.murphy@arm.com \
    --cc=sumit.semwal@linaro.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).