[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <d9bce937-1645-b209-a1d4-c7c0a6fcd1af@redhat.com>
Date: Thu, 12 Aug 2021 17:17:05 +0200
From: Jesper Dangaard Brouer <jbrouer@...hat.com>
To: Yunsheng Lin <linyunsheng@...wei.com>, davem@...emloft.net,
kuba@...nel.org
Cc: brouer@...hat.com, alexander.duyck@...il.com,
linux@...linux.org.uk, mw@...ihalf.com, linuxarm@...neuler.org,
yisen.zhuang@...wei.com, salil.mehta@...wei.com,
thomas.petazzoni@...tlin.com, hawk@...nel.org,
ilias.apalodimas@...aro.org, ast@...nel.org, daniel@...earbox.net,
john.fastabend@...il.com, akpm@...ux-foundation.org,
peterz@...radead.org, will@...nel.org, willy@...radead.org,
vbabka@...e.cz, fenghua.yu@...el.com, guro@...com,
peterx@...hat.com, feng.tang@...el.com, jgg@...pe.ca,
mcroce@...rosoft.com, hughd@...gle.com, jonathan.lemon@...il.com,
alobakin@...me, willemb@...gle.com, wenxu@...oud.cn,
cong.wang@...edance.com, haokexin@...il.com, nogikh@...gle.com,
elver@...gle.com, yhs@...com, kpsingh@...nel.org,
andrii@...nel.org, kafai@...com, songliubraving@...com,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
bpf@...r.kernel.org, chenhao288@...ilicon.com
Subject: Re: [PATCH net-next v2 2/4] page_pool: add interface to manipulate
frag count in page pool
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;
Powered by blists - more mailing lists