From: Robin Murphy <robin.murphy-5wv7dgnIgG8@public.gmane.org>
To: Yong Wu <yong.wu-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
Cc: laurent.pinchart+renesas-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org,
will.deacon-5wv7dgnIgG8@public.gmane.org,
dianders-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org,
iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org,
treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org,
brian.starkey-5wv7dgnIgG8@public.gmane.org,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
Subject: Re: [PATCH 4/5] iommu/dma: Finish optimising higher-order allocations
Date: Fri, 8 Apr 2016 17:33:32 +0100 [thread overview]
Message-ID: <5707DD5C.1070405@arm.com> (raw)
In-Reply-To: <1460093568.18911.6.camel@mhfsdcap03>
On 08/04/16 06:32, Yong Wu wrote:
> On Thu, 2016-04-07 at 18:42 +0100, Robin Murphy wrote:
>> /*
>> @@ -215,8 +221,9 @@ static struct page **__iommu_dma_alloc_pages(unsigned int count, gfp_t gfp)
>> * than a necessity, hence using __GFP_NORETRY until
>> * falling back to single-page allocations.
>> */
>> - for (order = min_t(unsigned int, order, __fls(count));
>> - order > 0; order--) {
>> + for (pgsize_orders &= (2U << __fls(count)) - 1;
>> + (order = __fls(pgsize_orders)) > min_order;
>> + pgsize_orders &= (1U << order) - 1) {
>> page = alloc_pages(gfp | __GFP_NORETRY, order);
>> if (!page)
>> continue;
>> @@ -230,7 +237,7 @@ static struct page **__iommu_dma_alloc_pages(unsigned int count, gfp_t gfp)
>> }
>> }
>> if (!page)
>> - page = alloc_page(gfp);
>> + page = alloc_pages(gfp, order);
>
> A small question: Do we need split it too if order != 0 here?
Ah, good point, somehow I missed that. It didn't stop my framebuffer
console working kernel-side, but indeed I can't mmap it due to the
un-split pages. I'll take that as an excuse to have a go at refactoring
the whole thing to maybe not reach 5 levels of indentation.
Thanks,
Robin.
>
>
>> if (!page) {
>> __iommu_dma_free_pages(pages, i);
>> return NULL;
> [...]
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
>
WARNING: multiple messages have this Message-ID (diff)
From: robin.murphy@arm.com (Robin Murphy)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 4/5] iommu/dma: Finish optimising higher-order allocations
Date: Fri, 8 Apr 2016 17:33:32 +0100 [thread overview]
Message-ID: <5707DD5C.1070405@arm.com> (raw)
In-Reply-To: <1460093568.18911.6.camel@mhfsdcap03>
On 08/04/16 06:32, Yong Wu wrote:
> On Thu, 2016-04-07 at 18:42 +0100, Robin Murphy wrote:
>> /*
>> @@ -215,8 +221,9 @@ static struct page **__iommu_dma_alloc_pages(unsigned int count, gfp_t gfp)
>> * than a necessity, hence using __GFP_NORETRY until
>> * falling back to single-page allocations.
>> */
>> - for (order = min_t(unsigned int, order, __fls(count));
>> - order > 0; order--) {
>> + for (pgsize_orders &= (2U << __fls(count)) - 1;
>> + (order = __fls(pgsize_orders)) > min_order;
>> + pgsize_orders &= (1U << order) - 1) {
>> page = alloc_pages(gfp | __GFP_NORETRY, order);
>> if (!page)
>> continue;
>> @@ -230,7 +237,7 @@ static struct page **__iommu_dma_alloc_pages(unsigned int count, gfp_t gfp)
>> }
>> }
>> if (!page)
>> - page = alloc_page(gfp);
>> + page = alloc_pages(gfp, order);
>
> A small question: Do we need split it too if order != 0 here?
Ah, good point, somehow I missed that. It didn't stop my framebuffer
console working kernel-side, but indeed I can't mmap it due to the
un-split pages. I'll take that as an excuse to have a go at refactoring
the whole thing to maybe not reach 5 levels of indentation.
Thanks,
Robin.
>
>
>> if (!page) {
>> __iommu_dma_free_pages(pages, i);
>> return NULL;
> [...]
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
>
next prev parent reply other threads:[~2016-04-08 16:33 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-07 17:42 [PATCH 0/5] Introduce per-domain page sizes Robin Murphy
2016-04-07 17:42 ` Robin Murphy
[not found] ` <cover.1460048991.git.robin.murphy-5wv7dgnIgG8@public.gmane.org>
2016-04-07 17:42 ` [PATCH 1/5] iommu: remove unused priv field from struct iommu_ops Robin Murphy
2016-04-07 17:42 ` Robin Murphy
2016-04-07 17:42 ` [PATCH 2/5] iommu: of: enforce const-ness of " Robin Murphy
2016-04-07 17:42 ` Robin Murphy
2016-04-07 17:42 ` [PATCH 3/5] iommu: Allow selecting page sizes per domain Robin Murphy
2016-04-07 17:42 ` Robin Murphy
2016-04-07 17:42 ` [PATCH 4/5] iommu/dma: Finish optimising higher-order allocations Robin Murphy
2016-04-07 17:42 ` Robin Murphy
[not found] ` <89763f6b1ac684c3d8712e38760bec55b7885e3b.1460048991.git.robin.murphy-5wv7dgnIgG8@public.gmane.org>
2016-04-08 5:32 ` Yong Wu
2016-04-08 5:32 ` Yong Wu
2016-04-08 16:33 ` Robin Murphy [this message]
2016-04-08 16:33 ` Robin Murphy
2016-04-13 16:29 ` [PATCH v2] " Robin Murphy
2016-04-13 16:29 ` Robin Murphy
[not found] ` <3e4572cb0a175061c1c4b436e3806ba9d7b9f199.1460563676.git.robin.murphy-5wv7dgnIgG8@public.gmane.org>
2016-04-21 5:47 ` Yong Wu
2016-04-21 5:47 ` Yong Wu
2016-04-07 17:42 ` [PATCH 5/5] iommu/arm-smmu: Use per-domain page sizes Robin Murphy
2016-04-07 17:42 ` Robin Murphy
2016-04-21 16:38 ` [PATCH 0/5] Introduce " Will Deacon
2016-04-21 16:38 ` Will Deacon
2016-05-09 11:21 ` Joerg Roedel
2016-05-09 11:21 ` Joerg Roedel
[not found] ` <20160509112138.GB13275-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
2016-05-09 11:45 ` Robin Murphy
2016-05-09 11:45 ` Robin Murphy
[not found] ` <57307863.1070706-5wv7dgnIgG8@public.gmane.org>
2016-05-09 14:51 ` Joerg Roedel
2016-05-09 14:51 ` Joerg Roedel
[not found] ` <20160509145157.GD13971-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
2016-05-09 15:18 ` Robin Murphy
2016-05-09 15:18 ` Robin Murphy
2016-05-09 15:50 ` Joerg Roedel
2016-05-09 15:50 ` Joerg Roedel
[not found] ` <ea520b8c72b5a72a1731bd35f6e3e50872fe6764.1460048991.git.robin.murphy-5wv7dgnIgG8@public.gmane.org>
2016-05-09 16:20 ` [PATCH v2] iommu/arm-smmu: Use " Robin Murphy
2016-05-09 16:20 ` Robin Murphy
[not found] ` <112fc0e5f9bbe08007778b8438b35025d8e876a4.1462810410.git.robin.murphy-5wv7dgnIgG8@public.gmane.org>
2016-05-10 9:45 ` Joerg Roedel
2016-05-10 9:45 ` Joerg Roedel
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=5707DD5C.1070405@arm.com \
--to=robin.murphy-5wv7dgnigg8@public.gmane.org \
--cc=brian.starkey-5wv7dgnIgG8@public.gmane.org \
--cc=dianders-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org \
--cc=iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
--cc=laurent.pinchart+renesas-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org \
--cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
--cc=treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \
--cc=will.deacon-5wv7dgnIgG8@public.gmane.org \
--cc=yong.wu-NuS5LvNUpcJWk0Htik3J/w@public.gmane.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.