lkml.org 
[lkml]   [2008]   [Jul]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 22/34] AMD IOMMU: add domain allocation and deallocation functions
On Thu, 26 Jun 2008 21:27:58 +0200 Joerg Roedel <joerg.roedel@amd.com> wrote:

> +static u16 domain_id_alloc(void)
> +{
> + unsigned long flags;
> + int id;
> +
> + write_lock_irqsave(&amd_iommu_devtable_lock, flags);
> + id = find_first_zero_bit(amd_iommu_pd_alloc_bitmap, MAX_DOMAIN_ID);
> + BUG_ON(id == 0);
> + if (id > 0 && id < MAX_DOMAIN_ID)
> + __set_bit(id, amd_iommu_pd_alloc_bitmap);
> + else
> + id = 0;
> + write_unlock_irqrestore(&amd_iommu_devtable_lock, flags);
> +
> + return id;
> +}

Presumably this is not performance-critical. If it is, an IDR
tree would help.


\
 
 \ /
  Last update: 2008-07-10 04:23    [W:0.681 / U:0.324 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site