[<prev] [next>] [day] [month] [year] [list]
Date: Tue, 7 Jul 2020 08:04:54 +0200
From: Markus Elfring <Markus.Elfring@....de>
To: Hillf Danton <hdanton@...a.com>, iommu@...ts.linux-foundation.org
Cc: kernel-janitors@...r.kernel.org, linux-kernel@...r.kernel.org,
Alex Williamson <alex.williamson@...hat.com>,
Christoph Hellwig <hch@....de>,
Jörg Rödel <joro@...tes.org>,
Kevin Tian <kevin.tian@...el.com>,
Yan Zhao <yan.y.zhao@...el.com>
Subject: Re: [RFC PATCH] vfio: type1: fix kthread use case
…
> +++ b/drivers/vfio/vfio_iommu_type1.c
> @@ -2798,7 +2798,7 @@ static int vfio_iommu_type1_dma_rw_chunk
…
> - bool kthread = current->mm == NULL;
> + bool kthread_load_mm;
> size_t offset;
How do you think about to reduce the scope for such variables?
https://refactoring.com/catalog/reduceScopeOfVariable.html
…
> @@ -2812,11 +2812,12 @@ static int vfio_iommu_type1_dma_rw_chunk
…
> if (!mm)
> return -EPERM;
…
> + kthread_load_mm = current->flags & PF_KTHREAD &&
> + current->mm == NULL;
…
Would you like to apply a more succinct code variant?
+ kthread_load_mm = current->flags & PF_KTHREAD && !current->mm;
Regards,
Markus
Powered by blists - more mailing lists