[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150807111156.GY14980@8bytes.org>
Date: Fri, 7 Aug 2015 13:11:56 +0200
From: Joerg Roedel <joro@...tes.org>
To: Alex Williamson <alex.williamson@...hat.com>
Cc: iommu@...ts.linux-foundation.org,
David Woodhouse <dwmw2@...radead.org>,
linux-kernel@...r.kernel.org, jroedel@...e.de
Subject: Re: [PATCH 03/26] iommu/vt-d: Split up iommu->domains array
On Thu, Aug 06, 2015 at 01:20:09PM -0600, Alex Williamson wrote:
> On Wed, 2015-08-05 at 17:18 +0200, Joerg Roedel wrote:
> > static void set_iommu_domain(struct intel_iommu *iommu, u16 did,
> > struct dmar_domain *domain)
> > {
> > - iommu->domains[did] = domain;
> > + struct dmar_domain **domains;
> > + int idx = did >> 8;
> > +
> > + if (!iommu->domains[idx]) {
> > + size_t size = 256 * sizeof(struct dmar_domain *);
> > + iommu->domains[idx] = kzalloc(size, GFP_ATOMIC);
> > + }
> > +
> > + domains = iommu->domains[idx];
> > + if (WARN_ON(!domains))
> > + return;
> > + else
> > + domains[did & 0xff] = domain;
> > }
>
> I'm tempted to suggest using pages here since we're dealing with 2k
> second level arrays, but maybe caring about pointers per page just makes
> that ugly.
The benefit would be that we avoid the slab-overhead while allocating.
But since the VT-d driver is needed on platforms with different
page-sizes, the handling would be indeed more complicated because we
have to split the index at a different point then depending on the
architecture.
Joerg
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists