Re: [bpf-next V5 PATCH 10/15] xdp: rhashtable with allocator ID to pointer mapping

Jesper Dangaard Brouer
2018-03-26T21:04:52Z

On Fri, 23 Mar 2018 09:56:50 -0700
Alexander Duyck <alexander.duyck@gmail.com> wrote:

> > +void xdp_return_frame(void *data, struct xdp_mem_info *mem)
> > +{
> > + struct xdp_mem_allocator *xa;
> > +
> > + rcu_read_lock();
> > + if (mem->id)
> > + xa = rhashtable_lookup(mem_id_ht, &mem->id, mem_id_rht_params);
> > + rcu_read_unlock();
> > +
> > + if (mem->type == MEM_TYPE_PAGE_SHARED) {
> > + page_frag_free(data);
> > + return;
> > + }
> > +
> > + if (mem->type == MEM_TYPE_PAGE_ORDER0) {
> > + struct page *page = virt_to_page(data); /* Assumes order0 page*/
> > +
> > + put_page(page);
> > + }
> > +}
> > +EXPORT_SYMBOL_GPL(xdp_return_frame);
> >
>
> I'm not sure what the point is of getting the xa value if it is not
> going to be used. Also I would assume there are types that won't even
> need the hash table lookup. I would prefer to see this bit held off on
> until you have something that actually needs it.

I agree, fixed.

--
Best regards,
Jesper Dangaard Brouer
MSc.CS, Principal Kernel Engineer at Red Hat
LinkedIn: http://www.linkedin.com/in/brouer