summaryrefslogtreecommitdiff
path: root/io_uring/notif.c
diff options
context:
space:
mode:
authorPavel Begunkov <asml.silence@gmail.com>2022-07-25 10:52:05 +0100
committerJens Axboe <axboe@kernel.dk>2022-07-25 09:48:25 -0600
commit6a9ce66f4d0872861e0bbc67eee6ce5dca5dd886 (patch)
tree81e66222f137d24bf38d367a9d29d4e91c6dd6c5 /io_uring/notif.c
parent2e32ba5607ee2b668baa8831dd74f7cc867a1f7e (diff)
io_uring/net: make page accounting more consistent
Make network page accounting more consistent with how buffer registration is working, i.e. account all memory to ctx->user. Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Link: https://lore.kernel.org/r/4aacfe64bbb81b27f9ecf5d5c219c69a07e5aa56.1658742118.git.asml.silence@gmail.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'io_uring/notif.c')
-rw-r--r--io_uring/notif.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/io_uring/notif.c b/io_uring/notif.c
index a93887451bbb..e986a0ed958c 100644
--- a/io_uring/notif.c
+++ b/io_uring/notif.c
@@ -14,12 +14,10 @@ static void __io_notif_complete_tw(struct callback_head *cb)
struct io_notif *notif = container_of(cb, struct io_notif, task_work);
struct io_rsrc_node *rsrc_node = notif->rsrc_node;
struct io_ring_ctx *ctx = notif->ctx;
- struct mmpin *mmp = &notif->uarg.mmp;
- if (mmp->user) {
- atomic_long_sub(mmp->num_pg, &mmp->user->locked_vm);
- free_uid(mmp->user);
- mmp->user = NULL;
+ if (notif->account_pages && ctx->user) {
+ __io_unaccount_mem(ctx->user, notif->account_pages);
+ notif->account_pages = 0;
}
if (likely(notif->task)) {
io_put_task(notif->task, 1);
@@ -121,6 +119,7 @@ struct io_notif *io_alloc_notif(struct io_ring_ctx *ctx,
notif->ctx = ctx;
notif->uarg.flags = SKBFL_ZEROCOPY_FRAG | SKBFL_DONT_ORPHAN;
notif->uarg.callback = io_uring_tx_zerocopy_callback;
+ notif->account_pages = 0;
}
notif->seq = slot->seq++;