lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 20 Apr 2023 11:38:50 +0100
From:   Robin Murphy <robin.murphy@....com>
To:     Zhen Lei <thunder.leizhen@...wei.com>,
        Joerg Roedel <joro@...tes.org>, Will Deacon <will@...nel.org>,
        iommu@...ts.linux.dev, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] iommu/iova: Optimize iova_magazine_alloc()

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@....com>

> Signed-off-by: Zhen Lei <thunder.leizhen@...wei.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)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ