mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Leizhen (ThunderTown)" <thunder.leizhen@huawei.com>
To: Robin Murphy <robin.murphy@arm.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 19:52:14 +0800	[thread overview]
Message-ID: <b6bf601b-0466-cb94-22b2-1189724410c9@huawei.com> (raw)
In-Reply-To: <e9b912ee-6b49-f369-82ff-daff49dc7511@arm.com>



On 2023/4/20 18:38, Robin Murphy wrote:
> 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?

Yes, sizeof(*mag) is the more recommended usage, I will post v2 tomorrow.

> 
>> +    if (mag)
>> +        mag->size = 0;
>> +
>> +    return mag;
>>   }
>>     static void iova_magazine_free(struct iova_magazine *mag)
> 
> .
> 

-- 
Regards,
  Zhen Lei

  reply	other threads:[~2023-04-20 11:52 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
2023-04-20 11:52   ` Leizhen (ThunderTown) [this message]
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=b6bf601b-0466-cb94-22b2-1189724410c9@huawei.com \
    --to=thunder.leizhen@huawei.com \
    --cc=iommu@lists.linux.dev \
    --cc=joro@8bytes.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robin.murphy@arm.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®