lkml.org 
[lkml]   [2021]   [Aug]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH net-next v2 2/4] page_pool: add interface to manipulate frag count in page pool
Date

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;

\
 
 \ /
  Last update: 2021-08-12 17:17    [W:0.632 / U:0.004 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site