[PATCH v5 01/11] iommu/vt-d: add wrapper functions for page allocations
Pasha Tatashin
pasha.tatashin at soleen.com
Thu Apr 4 06:56:16 PDT 2024
> Few minor nits.
Hi Linu,
Thank you for taking a look at this patch, my replies below.
> > +/*
> > + * All page allocations that should be reported to as "iommu-pagetables" to
> > + * userspace must use on of the functions below. This includes allocations of
> > + * page-tables and other per-iommu_domain configuration structures.
>
> /s/use on/use one/?
I will correct in the next version (if there is going to be one).
> > + *
> > + * This is necessary for the proper accounting as IOMMU state can be rather
> > + * large, i.e. multiple gigabytes in size.
> > + */
> > +
> > +/**
> > + * __iommu_alloc_pages - allocate a zeroed page of a given order.
> > + * @gfp: buddy allocator flags
>
> Shall we keep the comments generic here(avoid reference to allocator
> algo) ?
There are no references to allocator algorithm. I specify the zero
page because this function adds __GFP_ZERO. The order and gfp
arguments are provided by the caller, therefore, should be mentioned.
> > + * @order: page order
> > + *
> > + * returns the head struct page of the allocated page.
> > + */
> > +static inline struct page *__iommu_alloc_pages(gfp_t gfp, int order)
> > +{
> > + struct page *page;
> > +
> > + page = alloc_pages(gfp | __GFP_ZERO, order);
> > + if (unlikely(!page))
> > + return NULL;
> > +
> > + return page;
> > +}
> > +
> > +/**
> > + * __iommu_free_pages - free page of a given order
> > + * @page: head struct page of the page
> > + * @order: page order
> > + */
> > +static inline void __iommu_free_pages(struct page *page, int order)
> > +{
> > + if (!page)
> > + return;
> > +
> > + __free_pages(page, order);
> > +}
> > +
> > +/**
> > + * iommu_alloc_pages_node - allocate a zeroed page of a given order from
> > + * specific NUMA node.
> > + * @nid: memory NUMA node id
> > + * @gfp: buddy allocator flags
>
> Same here for this one and other references below.
ditto.
Thank you,
Pasha
More information about the Linux-rockchip
mailing list