Thread (35 messages) 35 messages, 4 authors, 2018-03-26

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

flat view

From: Jesper Dangaard Brouer <hidden>
Date: 2018-03-26 21:04:52

On Fri, 23 Mar 2018 09:56:50 -0700
Alexander Duyck [off-list ref] wrote:
quoted
+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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help