public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/amdkfd: simplify svm_range_unmap_from_gpus()
@ 2026-01-14 16:05 Yury Norov
  2026-01-20 23:15 ` Felix Kuehling
  0 siblings, 1 reply; 2+ messages in thread
From: Yury Norov @ 2026-01-14 16:05 UTC (permalink / raw)
  To: Felix Kuehling, Alex Deucher, Christian König, David Airlie,
	Simona Vetter, amd-gfx, dri-devel, linux-kernel
  Cc: Yury Norov

The function calls bitmap_or() followed by for_each_set_bit().
Switch it to the dedicated for_each_or_bit() and drop the temporary
bitmap.

Signed-off-by: Yury Norov <ynorov@nvidia.com>
---
 drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
index 79ea138897fc..eed76b13d191 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
@@ -1344,7 +1344,6 @@ static int
 svm_range_unmap_from_gpus(struct svm_range *prange, unsigned long start,
 			  unsigned long last, uint32_t trigger)
 {
-	DECLARE_BITMAP(bitmap, MAX_GPU_INSTANCE);
 	struct kfd_process_device *pdd;
 	struct dma_fence *fence = NULL;
 	struct kfd_process *p;
@@ -1362,11 +1361,9 @@ svm_range_unmap_from_gpus(struct svm_range *prange, unsigned long start,
 		prange->mapped_to_gpu = false;
 	}
 
-	bitmap_or(bitmap, prange->bitmap_access, prange->bitmap_aip,
-		  MAX_GPU_INSTANCE);
 	p = container_of(prange->svms, struct kfd_process, svms);
 
-	for_each_set_bit(gpuidx, bitmap, MAX_GPU_INSTANCE) {
+	for_each_or_bit(gpuidx, prange->bitmap_access, prange->bitmap_aip, MAX_GPU_INSTANCE) {
 		pr_debug("unmap from gpu idx 0x%x\n", gpuidx);
 		pdd = kfd_process_device_from_gpuidx(p, gpuidx);
 		if (!pdd) {
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] drm/amdkfd: simplify svm_range_unmap_from_gpus()
  2026-01-14 16:05 [PATCH] drm/amdkfd: simplify svm_range_unmap_from_gpus() Yury Norov
@ 2026-01-20 23:15 ` Felix Kuehling
  0 siblings, 0 replies; 2+ messages in thread
From: Felix Kuehling @ 2026-01-20 23:15 UTC (permalink / raw)
  To: Yury Norov, Alex Deucher, Christian König, David Airlie,
	Simona Vetter, amd-gfx, dri-devel, linux-kernel

On 2026-01-14 11:05, Yury Norov wrote:
> The function calls bitmap_or() followed by for_each_set_bit().
> Switch it to the dedicated for_each_or_bit() and drop the temporary
> bitmap.
>
> Signed-off-by: Yury Norov <ynorov@nvidia.com>

The patch is

Reviewed-by: Felix Kuehling <felix.kuehling@amd.com>

I'm applying it to amd-staging-drm-next.

Thanks,
   Felix


> ---
>   drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 5 +----
>   1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
> index 79ea138897fc..eed76b13d191 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
> @@ -1344,7 +1344,6 @@ static int
>   svm_range_unmap_from_gpus(struct svm_range *prange, unsigned long start,
>   			  unsigned long last, uint32_t trigger)
>   {
> -	DECLARE_BITMAP(bitmap, MAX_GPU_INSTANCE);
>   	struct kfd_process_device *pdd;
>   	struct dma_fence *fence = NULL;
>   	struct kfd_process *p;
> @@ -1362,11 +1361,9 @@ svm_range_unmap_from_gpus(struct svm_range *prange, unsigned long start,
>   		prange->mapped_to_gpu = false;
>   	}
>   
> -	bitmap_or(bitmap, prange->bitmap_access, prange->bitmap_aip,
> -		  MAX_GPU_INSTANCE);
>   	p = container_of(prange->svms, struct kfd_process, svms);
>   
> -	for_each_set_bit(gpuidx, bitmap, MAX_GPU_INSTANCE) {
> +	for_each_or_bit(gpuidx, prange->bitmap_access, prange->bitmap_aip, MAX_GPU_INSTANCE) {
>   		pr_debug("unmap from gpu idx 0x%x\n", gpuidx);
>   		pdd = kfd_process_device_from_gpuidx(p, gpuidx);
>   		if (!pdd) {

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-01-20 23:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-14 16:05 [PATCH] drm/amdkfd: simplify svm_range_unmap_from_gpus() Yury Norov
2026-01-20 23:15 ` Felix Kuehling

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox