Messages in this thread | | | From | Jesper Dangaard Brouer <> | Subject | Re: [PATCH net-next v2 2/4] page_pool: add interface to manipulate frag count in page pool | Date | Thu, 12 Aug 2021 17:17:05 +0200 |
| |
On 06/08/2021 04.46, Yunsheng Lin wrote: > +static inline long page_pool_atomic_sub_frag_count_return(struct page *page, > + long nr) > +{ > + long ret; > + > + /* As suggested by Alexander, atomic_long_read() may cover up the > + * reference count errors, so avoid calling atomic_long_read() in > + * the cases of freeing or draining the page_frags, where we would > + * not expect it to match or that are slowpath anyway. > + */ > + if (__builtin_constant_p(nr) && > + atomic_long_read(&page->pp_frag_count) == nr) > + return 0; > + > + ret = atomic_long_sub_return(nr, &page->pp_frag_count); > + WARN_ON(ret < 0);
I worried about this WARN_ON() as it generates an 'ud2' instruction which influence I-cache fetching. But I have disassembled (objdump) the page_pool.o binary and the ud2 gets placed last in the main function page_pool_put_page() that use this inlined function. Thus, I assume this is not a problem :-)
> + return ret;
| |