[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <60539053-419a-d8e7-79c3-d23c005505b4@oracle.com>
Date: Wed, 11 Jan 2023 10:16:02 +0000
From: John Garry <john.g.garry@...cle.com>
To: Ming Lei <ming.lei@...hat.com>,
Thomas Gleixner <tglx@...utronix.de>,
Jens Axboe <axboe@...nel.dk>
Cc: linux-kernel@...r.kernel.org, linux-block@...r.kernel.org,
Christoph Hellwig <hch@....de>
Subject: Re: [PATCH V4 3/6] genirq/affinity: Don't pass irq_affinity_desc
array to irq_build_affinity_masks
On 27/12/2022 02:29, Ming Lei wrote:
> Prepare for abstracting irq_build_affinity_masks() into one public helper
> for assigning all CPUs evenly into several groups. Don't pass
> irq_affinity_desc array to irq_build_affinity_masks, instead return
> a cpumask array by storing each assigned group into one element of
> the array.
>
> This way helps us to provide generic interface for grouping all CPUs
> evenly from NUMA and CPU locality viewpoint, and the cost is one extra
> allocation in irq_build_affinity_masks(), which should be fine since
> it is done via GFP_KERNEL and irq_build_affinity_masks() is called very
> less.
>
> Reviewed-by: Christoph Hellwig<hch@....de>
> Signed-off-by: Ming Lei<ming.lei@...hat.com>
Reviewed-by: John Garry <john.g.garry@...cle.com>
> ---
> kernel/irq/affinity.c | 34 ++++++++++++++++++++++++----------
> 1 file changed, 24 insertions(+), 10 deletions(-)
>
> diff --git a/kernel/irq/affinity.c b/kernel/irq/affinity.c
> index da6379cd27fd..00bba1020ecb 100644
> --- a/kernel/irq/affinity.c
> +++ b/kernel/irq/affinity.c
> @@ -249,7 +249,7 @@ static int __irq_build_affinity_masks(unsigned int startvec,
>
> fail_npresmsk:
> @@ -393,7 +398,11 @@ static int irq_build_affinity_masks(unsigned int numvecs,
>
> fail_nmsk:
> free_cpumask_var(nmsk);
> - return ret < 0 ? ret : 0;
> + if (ret < 0) {
> + kfree(masks);
> + return NULL;
I dislike non-failure path passing through "fail" labels, but that is
how the current code is...
> + }
> + return masks;
> }
>
Powered by blists - more mailing lists