From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 77147C433FE for ; Sun, 16 Oct 2022 07:08:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229722AbiJPHI6 (ORCPT ); Sun, 16 Oct 2022 03:08:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47502 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229725AbiJPHI5 (ORCPT ); Sun, 16 Oct 2022 03:08:57 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 650EE38A13 for ; Sun, 16 Oct 2022 00:08:56 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0191260AB2 for ; Sun, 16 Oct 2022 07:08:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 12448C433C1; Sun, 16 Oct 2022 07:08:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1665904135; bh=N2dJbFpaP1nxKsPEY1NPMqZtR6sdWG3s8+CkIyBRosA=; h=Subject:To:Cc:From:Date:From; b=FoLADdusGVoiGd2otqwtW0GPxRbigrxfgVIXo8sqlf8nMoePYTUtDQGNuBQcyTQOK g5ioRVGK++uQ167/X8AzNgSHcJwysomZ+1MaTx1021y5MYkctw1uRnOj0ant4u+MZ0 jBohPjPkShVJU9KMtWQv9eVp7ICjg/At0e2BzOwE= Subject: FAILED: patch "[PATCH] io_uring: correct pinned_vm accounting" failed to apply to 5.10-stable tree To: asml.silence@gmail.com, Stable@vger.kernel.org, axboe@kernel.dk Cc: From: Date: Sun, 16 Oct 2022 09:09:34 +0200 Message-ID: <166590417434237@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org The patch below does not apply to the 5.10-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . Possible dependencies: 42b6419d0aba ("io_uring: correct pinned_vm accounting") ed29b0b4fd83 ("io_uring: move to separate directory") ab4094024784 ("io_uring: optimise rsrc referencing") a46be971edb6 ("io_uring: optimise io_req_set_rsrc_node()") d886e185a128 ("io_uring: control ->async_data with a REQ_F flag") ef05d9ebcc92 ("io_uring: kill off ->inflight_entry field") d4b7a5ef2b9c ("io_uring: inline completion batching helpers") 3aa83bfb6e5c ("io_uring: add a helper for batch free") c2b6c6bc4e0d ("io_uring: replace list with stack for req caches") 3ab665b74e59 ("io_uring: remove allocation cache array") 6f33b0bc4ea4 ("io_uring: use slist for completion batching") c450178d9be9 ("io_uring: dedup CQE flushing non-empty checks") 4b628aeb69cc ("io_uring: kill off ios_left") 4c928904ff77 ("block: move CONFIG_BLOCK guard to top Makefile") ddf21bd8ab98 ("Merge tag 'iov_iter.3-5.15-2021-09-17' of git://git.kernel.dk/linux-block") thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From 42b6419d0aba47c5d8644cdc0b68502254671de5 Mon Sep 17 00:00:00 2001 From: Pavel Begunkov Date: Tue, 4 Oct 2022 03:19:08 +0100 Subject: [PATCH] io_uring: correct pinned_vm accounting ->mm_account should be released only after we free all registered buffers, otherwise __io_sqe_buffers_unregister() will see a NULL ->mm_account and skip locked_vm accounting. Cc: Signed-off-by: Pavel Begunkov Link: https://lore.kernel.org/r/6d798f65ed4ab8db3664c4d3397d4af16ca98846.1664849932.git.asml.silence@gmail.com Signed-off-by: Jens Axboe diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c index 63f6ce5e5355..ea5cee593bbd 100644 --- a/io_uring/io_uring.c +++ b/io_uring/io_uring.c @@ -2585,12 +2585,6 @@ static void io_req_caches_free(struct io_ring_ctx *ctx) static __cold void io_ring_ctx_free(struct io_ring_ctx *ctx) { io_sq_thread_finish(ctx); - - if (ctx->mm_account) { - mmdrop(ctx->mm_account); - ctx->mm_account = NULL; - } - io_rsrc_refs_drop(ctx); /* __io_rsrc_put_work() may need uring_lock to progress, wait w/o it */ io_wait_rsrc_data(ctx->buf_data); @@ -2633,6 +2627,10 @@ static __cold void io_ring_ctx_free(struct io_ring_ctx *ctx) WARN_ON_ONCE(!list_empty(&ctx->ltimeout_list)); WARN_ON_ONCE(ctx->notif_slots || ctx->nr_notif_slots); + if (ctx->mm_account) { + mmdrop(ctx->mm_account); + ctx->mm_account = NULL; + } io_mem_free(ctx->rings); io_mem_free(ctx->sq_sqes);