public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@ziepe.ca>
To: Lu Baolu <baolu.lu@linux.intel.com>
Cc: Joerg Roedel <joro@8bytes.org>, Will Deacon <will@kernel.org>,
	Robin Murphy <robin.murphy@arm.com>,
	Kevin Tian <kevin.tian@intel.com>,
	iommu@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 1/2] iommu/vt-d: Use ida to manage domain id
Date: Tue, 6 May 2025 14:29:32 -0300	[thread overview]
Message-ID: <20250506172932.GA33739@ziepe.ca> (raw)
In-Reply-To: <20250430021135.2370244-2-baolu.lu@linux.intel.com>

On Wed, Apr 30, 2025 at 10:11:34AM +0800, Lu Baolu wrote:
> Switch the intel iommu driver to use the ida mechanism for managing domain
> IDs, replacing the previous fixed-size bitmap.
> 
> The previous approach allocated a bitmap large enough to cover the maximum
> number of domain IDs supported by the hardware, regardless of the actual
> number of domains in use. This led to unnecessary memory consumption,
> especially on systems supporting a large number of iommu units but only
> utilizing a small number of domain IDs.
> 
> The ida allocator dynamically manages the allocation and freeing of integer
> IDs, only consuming memory for the IDs that are currently in use. This
> significantly optimizes memory usage compared to the fixed-size bitmap.
> 
> Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
> Reviewed-by: Kevin Tian <kevin.tian@intel.com>
> ---
>  drivers/iommu/intel/dmar.c  |  3 ++
>  drivers/iommu/intel/iommu.c | 80 ++++++++-----------------------------
>  drivers/iommu/intel/iommu.h | 19 +++++++--
>  3 files changed, 34 insertions(+), 68 deletions(-)

Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>

Jason

  reply	other threads:[~2025-05-06 17:29 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-30  2:11 [PATCH v2 0/2] iommu/vt-d: Use ida for domain ID management Lu Baolu
2025-04-30  2:11 ` [PATCH v2 1/2] iommu/vt-d: Use ida to manage domain id Lu Baolu
2025-05-06 17:29   ` Jason Gunthorpe [this message]
2025-04-30  2:11 ` [PATCH v2 2/2] iommu/vt-d: Replace spin_lock with mutex to protect domain ida Lu Baolu
2025-05-06 17:29   ` Jason Gunthorpe
2025-05-12  6:37 ` [PATCH v2 0/2] iommu/vt-d: Use ida for domain ID management Baolu Lu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250506172932.GA33739@ziepe.ca \
    --to=jgg@ziepe.ca \
    --cc=baolu.lu@linux.intel.com \
    --cc=iommu@lists.linux.dev \
    --cc=joro@8bytes.org \
    --cc=kevin.tian@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robin.murphy@arm.com \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox