提交 d3b42f14 编写于 作者: B Björn Töpel 提交者: Daniel Borkmann

xsk: convert atomic_t to refcount_t

Introduce refcount_t, in favor of atomic_t.
Signed-off-by: NBjörn Töpel <bjorn.topel@intel.com>
Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
上级 a49049ea
...@@ -78,7 +78,7 @@ static void xdp_umem_release_deferred(struct work_struct *work) ...@@ -78,7 +78,7 @@ static void xdp_umem_release_deferred(struct work_struct *work)
void xdp_get_umem(struct xdp_umem *umem) void xdp_get_umem(struct xdp_umem *umem)
{ {
atomic_inc(&umem->users); refcount_inc(&umem->users);
} }
void xdp_put_umem(struct xdp_umem *umem) void xdp_put_umem(struct xdp_umem *umem)
...@@ -86,7 +86,7 @@ void xdp_put_umem(struct xdp_umem *umem) ...@@ -86,7 +86,7 @@ void xdp_put_umem(struct xdp_umem *umem)
if (!umem) if (!umem)
return; return;
if (atomic_dec_and_test(&umem->users)) { if (refcount_dec_and_test(&umem->users)) {
INIT_WORK(&umem->work, xdp_umem_release_deferred); INIT_WORK(&umem->work, xdp_umem_release_deferred);
schedule_work(&umem->work); schedule_work(&umem->work);
} }
...@@ -206,7 +206,7 @@ static int xdp_umem_reg(struct xdp_umem *umem, struct xdp_umem_reg *mr) ...@@ -206,7 +206,7 @@ static int xdp_umem_reg(struct xdp_umem *umem, struct xdp_umem_reg *mr)
umem->frame_size_log2 = ilog2(frame_size); umem->frame_size_log2 = ilog2(frame_size);
umem->nfpp_mask = nfpp - 1; umem->nfpp_mask = nfpp - 1;
umem->nfpplog2 = ilog2(nfpp); umem->nfpplog2 = ilog2(nfpp);
atomic_set(&umem->users, 1); refcount_set(&umem->users, 1);
err = xdp_umem_account_pages(umem); err = xdp_umem_account_pages(umem);
if (err) if (err)
......
...@@ -27,7 +27,7 @@ struct xdp_umem { ...@@ -27,7 +27,7 @@ struct xdp_umem {
struct pid *pid; struct pid *pid;
unsigned long address; unsigned long address;
size_t size; size_t size;
atomic_t users; refcount_t users;
struct work_struct work; struct work_struct work;
}; };
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册