From: Robin Murphy <robin.murphy@arm.com>
To: Zhen Lei <thunder.leizhen@huawei.com>,
Joerg Roedel <joro@8bytes.org>, Will Deacon <will@kernel.org>,
iommu@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] iommu/iova: Optimize iova_magazine_alloc()
Date: Thu, 20 Apr 2023 11:38:50 +0100 [thread overview]
Message-ID: <e9b912ee-6b49-f369-82ff-daff49dc7511@arm.com> (raw)
In-Reply-To: <20230418062518.852-1-thunder.leizhen@huawei.com>
On 2023-04-18 07:25, Zhen Lei wrote:
> Only the member 'size' needs to be initialized to 0. Clearing the array
> pfns[], which is about 1 KiB in size, not only wastes time, but also
> causes cache pollution.
Makes sense to me.
Acked-by: Robin Murphy <robin.murphy@arm.com>
> Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
> ---
> drivers/iommu/iova.c | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/iommu/iova.c b/drivers/iommu/iova.c
> index fe452ce466429a7..c970b9a2819d7bb 100644
> --- a/drivers/iommu/iova.c
> +++ b/drivers/iommu/iova.c
> @@ -647,7 +647,13 @@ struct iova_rcache {
>
> static struct iova_magazine *iova_magazine_alloc(gfp_t flags)
> {
> - return kzalloc(sizeof(struct iova_magazine), flags);
> + struct iova_magazine *mag;
> +
> + mag = kmalloc(sizeof(struct iova_magazine), flags);
Nit: maybe sizeof(*mag) is preferable?
> + if (mag)
> + mag->size = 0;
> +
> + return mag;
> }
>
> static void iova_magazine_free(struct iova_magazine *mag)
next prev parent reply other threads:[~2023-04-20 10:41 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-18 6:25 Zhen Lei
2023-04-20 10:38 ` Robin Murphy [this message]
2023-04-20 11:52 ` Leizhen (ThunderTown)
2023-05-22 15:10 ` 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=e9b912ee-6b49-f369-82ff-daff49dc7511@arm.com \
--to=robin.murphy@arm.com \
--cc=iommu@lists.linux.dev \
--cc=joro@8bytes.org \
--cc=linux-kernel@vger.kernel.org \
--cc=thunder.leizhen@huawei.com \
--cc=will@kernel.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
all inboxes | Powered by JetHome®