io_uring: ensure that cached task references are always put on exit
commit e775f93f upstream. io_uring caches task references to avoid doing atomics for each of them per request. If a request is put from the same task that allocated it, then we can maintain a per-ctx cache of them. This obviously relies on io_uring always pruning caches in a reliable way, and there's currently a case off io_uring fd release where we can miss that. One example is a ring setup with IOPOLL, which relies on the task polling for completions, which will free them. However, if such a task submits a request and then exits or closes the ring without reaping the completion, then ring release will reap and put. If release happens from that very same task, the completed request task refs will get put back into the cache pool. This is problematic, as we're now beyond the point of pruning caches. Manually drop these caches after doing an IOPOLL reap. This releases references from the current task, which is enough. If another task happens to be doing the release, then the caching will not be triggered and there's no issue. Cc: stable@vger.kernel.org Fixes: e98e49b2 ("io_uring: extend task put optimisations") Reported-by:Homin Rhee <hominlab@gmail.com> Signed-off-by:
Jens Axboe <axboe@kernel.dk> Signed-off-by:
Sasha Levin <sashal@kernel.org>
Loading
-
mentioned in commit 2e509493
-
mentioned in commit 64ae312b
-
mentioned in commit a04da5df
-
mentioned in commit 192419ba
-
mentioned in commit bb0ef03b
-
mentioned in commit d94dce98
-
mentioned in commit 5d8715e9
-
mentioned in commit f138022c
-
mentioned in commit 7852371b
-
mentioned in commit 0edbe68c
-
mentioned in commit 9166f541
-
mentioned in commit 9166f541
-
mentioned in commit fb0cece7
-
mentioned in commit fb0cece7
-
mentioned in commit e0d675ca
-
mentioned in commit 2416d4ee
-
mentioned in commit e2297ee9
-
mentioned in commit b6482c90
-
mentioned in commit d2c7b6a2
-
mentioned in commit b28a5779
-
mentioned in commit b28a5779
Please sign in to comment