From patchwork Fri Mar 15 21:46:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Begunkov X-Patchwork-Id: 13594082 Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com [209.85.128.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 735B0481BA for ; Fri, 15 Mar 2024 21:47:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710539251; cv=none; b=BL78IfI0xBfDVp2lMq8+2CzyeT4d+2AFh2Noc923X2T77+th1pkTlTw9UaP7IvLT/dlHP3KASu5a4ef79OA8o06rOPMkTGzixAJ6o74vlOBerK+FWllOkEgYz5Yup1CwhBCFF/jtwsD7iPgdcXtP7xoo/rBxqT9xjLDlD/rGZCI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710539251; c=relaxed/simple; bh=j9NhxQQrGcKYlrA72sJUr+2amqXP/8iB15dKRw8WgEQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=HmRKCL2iCHJOSWoDy4Id6ofElqhJvfevJRtwz233sTc77NeNDpJZ1jom7/scLuHTUwm4MMEwE/4tThYKaWOIe9PAwekEIw0yrOiXF/NA9CfDPdLq7HQj3HtaxQde1vGRuhJyIScWWGwjMuyeJCfJ4K5r70X5KWs0OY3pj7RadpQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=HFXaLInw; arc=none smtp.client-ip=209.85.128.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="HFXaLInw" Received: by mail-wm1-f41.google.com with SMTP id 5b1f17b1804b1-41402466fb8so6117085e9.0 for ; Fri, 15 Mar 2024 14:47:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710539247; x=1711144047; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=pxQKVMLtAtMT4U+g+357Xz8uc4uGRjSVOIaXOKfo2ks=; b=HFXaLInwhB3Rjbx1wqelptcHrxjn49GyLJOV0542D4ge4My6RxkIHIvcUgCX/wR2wa j7HLPqpMmaCQ6q7on4kdJL/akgnTH46DV7lrLVMoAMG/J2GT8QsqaeYDmwilkPCtcaDO a5csOlQAnscnVzRNfne0KQeZcbQCDkFrjDJqIYThoySm6FjLiciYJs3RB6/URpUS1XY+ 2TxDn/T1dZYVPJerk9r7PKQuv+AE9eVmhUn9hO3ZFJTbjFwrkOb3JbpAxgz8gXk7ripz LAa2LWW29X6jBaZImZHVyxQG83cYV5QHMKoEiUFw2fSnm/7YrPJCFQMi8aiuTb7eUnLW RzCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710539247; x=1711144047; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=pxQKVMLtAtMT4U+g+357Xz8uc4uGRjSVOIaXOKfo2ks=; b=gJUb9nwBD4Lkbbf8mQCyQNtn4BE5ECXSVRqOPfC4x6dHLPer1pCVxWJ5+g/uvloMsq 13Ofd57O9DN7SbswvQdHd8X6Uot+sQ+W9+jB3LWI2JlpDDRDakU4MyQWTkxQ+XKCxjvi YahzVI6RcqZIZp02k3yDEYFtdjXPsUDXy5nZ45aipawFPQjOq85IFqCYyjQMM0240pBL 1g1VzcJQm31Esyo/qxXHvkzOyRk+0QhMUSS4tv7tE8mWLrD0uNLqvPMkmYqTF7NA6shO W2RuS7w0g91JJZb/IDOKDS/41W//iVK5aKx7L69OBFIS6YklLMIkTXcl+FZtEXHuzwCY eA+Q== X-Gm-Message-State: AOJu0YwtzgmdiBJ5iUAP3ocaBUR6jnbg2l2qFBduW/wG2cH5wKmIHN5Y I+82muQApJeV2MgE26Rg4maKpzvuiiTwPoA1q2lTNhHhY9ol0sLNL6fE/HNi X-Google-Smtp-Source: AGHT+IFJTsXSS2W9IJN3GtoxBJlbZTS95R+WLk1wyGUmB/JVQN3INu8ggTfvGWunQus/JdiLocEUPw== X-Received: by 2002:a05:600c:4f91:b0:413:2852:2835 with SMTP id n17-20020a05600c4f9100b0041328522835mr4426778wmq.17.1710539246953; Fri, 15 Mar 2024 14:47:26 -0700 (PDT) Received: from 127.0.0.1localhost ([185.69.144.99]) by smtp.gmail.com with ESMTPSA id m15-20020a05600c4f4f00b004130c1dc29csm7040881wmq.22.2024.03.15.14.47.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Mar 2024 14:47:26 -0700 (PDT) From: Pavel Begunkov To: io-uring@vger.kernel.org Cc: Jens Axboe , asml.silence@gmail.com Subject: [PATCH 1/3] io_uring: remove current check from complete_post Date: Fri, 15 Mar 2024 21:46:00 +0000 Message-ID: X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: io-uring@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 task_work execution is now always locked, and we shouldn't get into io_req_complete_post() from them. That means that complete_post() is always called out of the original task context and we don't even need to check current. Signed-off-by: Pavel Begunkov --- io_uring/io_uring.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c index 023fcf5d52c1..025709cadab9 100644 --- a/io_uring/io_uring.c +++ b/io_uring/io_uring.c @@ -978,7 +978,7 @@ void io_req_complete_post(struct io_kiocb *req, unsigned issue_flags) { struct io_ring_ctx *ctx = req->ctx; - if (ctx->task_complete && ctx->submitter_task != current) { + if (ctx->task_complete) { req->io_task_work.func = io_req_task_complete; io_req_task_work_add(req); } else if (!(issue_flags & IO_URING_F_UNLOCKED) || From patchwork Fri Mar 15 21:46:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Begunkov X-Patchwork-Id: 13594083 Received: from mail-wm1-f42.google.com (mail-wm1-f42.google.com [209.85.128.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5A891548E7 for ; Fri, 15 Mar 2024 21:47:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710539252; cv=none; b=AXYOywSg8mNMofgF5F5rPjbFXs5GB7WsAyuk20fpmT9BjHsVfNkbKBHYTfUuK4NFQOfS8OZsYYOBSkBv9Fy08pulWpmAGRq3GqfnK2YP0m0mjv9XEtooIMcEgi5Au+qhSeI/V6Q10NETu/mlr6Xypgxbg6Eckog7AFJp6GCF+Jc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710539252; c=relaxed/simple; bh=a31opw+MDT2rMo7cC3qrdDXOcRpISkWUa8e4q0pMWcA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Whlg/ZigM6JYzgysp5nm9chQ/ACQ8/XDs9qrErJu8QDK2UwCNaOE8vSbDTe6jh974F9isNXo1JAGrjbsjLUYF5/kM2jxrEitass3yD1j/D7163wwLNK0tCherQ+rJGDIZkKn4+wWGGdDDHyKfvX2MevbsZLs4rNrrR/J4hUBxWM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=iJ7NqL2P; arc=none smtp.client-ip=209.85.128.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="iJ7NqL2P" Received: by mail-wm1-f42.google.com with SMTP id 5b1f17b1804b1-41405d77c7bso2593585e9.3 for ; Fri, 15 Mar 2024 14:47:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710539248; x=1711144048; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=rW/LRhpLvKrsLND2TJlV/mJ25bg5GhErG6+/+asx+EM=; b=iJ7NqL2PKDlEUTXkCmSlWaPHsNaq5dLOzHOCxZHIR6P6aULqY0NIsdRbNZllkCV/5o ojQGGJcQHh+fkPKG3vPzLrTMrkPjEM+GMa+dWKdOIXQilNuIMDJwwyAggnXbKc8UUjj4 iV+4htsAq7N6MR25IXnhGj4OJH9oN1uir3sZ5br7+cyocgBoOoef5z1m5WLdj0t9d3cN 0EyPzgokSFenSm1b4BRzQIEqis9feYL+xbFxcuQrUPuosN2+BsmOsjIBYVTw3JiyUWng 6NDn+TxNZhW10+bZU+MWegAqsrsy/A7vnt5A4bHHmV8y0gN9E5TckzeJmsE9A8CcqTr6 gOvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710539248; x=1711144048; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=rW/LRhpLvKrsLND2TJlV/mJ25bg5GhErG6+/+asx+EM=; b=e4ye85eiNAM/Y11C6DtrdvSF32oHqsbY4CRICLOYg6+uA3tA7PYe8D4lAiLzx3FGAY n+i5XHQ4E6lYWe+2tf6xyjaU496fuuaeXbYtBjDUa5i+eItkjkGw5Cn718/vS2FpDGf8 eOdTxOzVuuShd4WL6pVgd2plrnjGhRcU6Nkf7kCOS1Dg8f8TVM0l0PKDQY8PjRUEBH/y RfRQT94waLMDFzY09VNZctqdDa6+aJemKx+EQ1sOtD9hbdrfAGNyWLhzit05/zYB2Wo+ JFslYfqZkoXfyKGRHNSt1RxailMXAMvI6uTG3CzuGrhwE6tKH76QRkrTwG7WH89+X02c IXGQ== X-Gm-Message-State: AOJu0YwgpF8849KIQB3mGpcsQ50jFBCRYalPFV/cYFFjfYUULed3SOHa e3KCo5LsNVz21b1Gd5gRoeh9WURKkwNewJfPoGvAYP2cR/uksXUdc910ISep X-Google-Smtp-Source: AGHT+IFCEzQLXKIqN4BqHy3gm5DlzRzSR/1MbojbnzDjpRX85YqJLqiGszknL16tOpmbj1rEt1EsBQ== X-Received: by 2002:a05:600c:a007:b0:413:f58f:2f66 with SMTP id jg7-20020a05600ca00700b00413f58f2f66mr4274484wmb.9.1710539248420; Fri, 15 Mar 2024 14:47:28 -0700 (PDT) Received: from 127.0.0.1localhost ([185.69.144.99]) by smtp.gmail.com with ESMTPSA id m15-20020a05600c4f4f00b004130c1dc29csm7040881wmq.22.2024.03.15.14.47.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Mar 2024 14:47:27 -0700 (PDT) From: Pavel Begunkov To: io-uring@vger.kernel.org Cc: Jens Axboe , asml.silence@gmail.com Subject: [PATCH 2/3] io_uring: refactor io_req_complete_post() Date: Fri, 15 Mar 2024 21:46:01 +0000 Message-ID: X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: io-uring@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Make io_req_complete_post() to push all IORING_SETUP_IOPOLL requests to task_work, it's much cleaner and should normally happen. We couldn't do it before because there was a possibility of looping in complete_post() -> tw -> complete_post() -> ... Also, unexport the function and inline __io_req_complete_post(). Signed-off-by: Pavel Begunkov --- io_uring/io_uring.c | 29 +++++++++++------------------ io_uring/io_uring.h | 1 - 2 files changed, 11 insertions(+), 19 deletions(-) diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c index 025709cadab9..846d67a9c72e 100644 --- a/io_uring/io_uring.c +++ b/io_uring/io_uring.c @@ -926,11 +926,21 @@ bool io_req_post_cqe(struct io_kiocb *req, s32 res, u32 cflags) return posted; } -static void __io_req_complete_post(struct io_kiocb *req, unsigned issue_flags) +static void io_req_complete_post(struct io_kiocb *req, unsigned issue_flags) { struct io_ring_ctx *ctx = req->ctx; struct io_rsrc_node *rsrc_node = NULL; + /* + * Handle special CQ sync cases via task_work. DEFER_TASKRUN requires + * the submitter task context, IOPOLL protects with uring_lock. + */ + if (ctx->task_complete || (ctx->flags & IORING_SETUP_IOPOLL)) { + req->io_task_work.func = io_req_task_complete; + io_req_task_work_add(req); + return; + } + io_cq_lock(ctx); if (!(req->flags & REQ_F_CQE_SKIP)) { if (!io_fill_cqe_req(ctx, req)) @@ -974,23 +984,6 @@ static void __io_req_complete_post(struct io_kiocb *req, unsigned issue_flags) } } -void io_req_complete_post(struct io_kiocb *req, unsigned issue_flags) -{ - struct io_ring_ctx *ctx = req->ctx; - - if (ctx->task_complete) { - req->io_task_work.func = io_req_task_complete; - io_req_task_work_add(req); - } else if (!(issue_flags & IO_URING_F_UNLOCKED) || - !(ctx->flags & IORING_SETUP_IOPOLL)) { - __io_req_complete_post(req, issue_flags); - } else { - mutex_lock(&ctx->uring_lock); - __io_req_complete_post(req, issue_flags & ~IO_URING_F_UNLOCKED); - mutex_unlock(&ctx->uring_lock); - } -} - void io_req_defer_failed(struct io_kiocb *req, s32 res) __must_hold(&ctx->uring_lock) { diff --git a/io_uring/io_uring.h b/io_uring/io_uring.h index 4bc96470e591..db6cab40bbbf 100644 --- a/io_uring/io_uring.h +++ b/io_uring/io_uring.h @@ -65,7 +65,6 @@ bool io_cqe_cache_refill(struct io_ring_ctx *ctx, bool overflow); void io_req_cqe_overflow(struct io_kiocb *req); int io_run_task_work_sig(struct io_ring_ctx *ctx); void io_req_defer_failed(struct io_kiocb *req, s32 res); -void io_req_complete_post(struct io_kiocb *req, unsigned issue_flags); bool io_post_aux_cqe(struct io_ring_ctx *ctx, u64 user_data, s32 res, u32 cflags); bool io_req_post_cqe(struct io_kiocb *req, s32 res, u32 cflags); void __io_commit_cqring_flush(struct io_ring_ctx *ctx); From patchwork Fri Mar 15 21:46:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Begunkov X-Patchwork-Id: 13594084 Received: from mail-wm1-f49.google.com (mail-wm1-f49.google.com [209.85.128.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6FE525491A for ; Fri, 15 Mar 2024 21:47:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710539253; cv=none; b=b6DpbZ9HmAT+xthVIzopS95tfVBiJSOItmwyDU7ybrCF5YnlACtysc/4Bt9jVJrJcZ1cp//PIfmdD7e3hOn69QF4cDjYZNd/4PEP8ej5A0Zpl2CWgZk6ansHSxO6g3nb9Q0DXKaVWTfEEmHrPdSo+aAJB7M0CaVsCHY6Jc09AxQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710539253; c=relaxed/simple; bh=oKOwkD9uEqWxyz2+JByIDGBCBcGuVlfa7hISPAHEaNg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=org2SQpkdNLUCmWIQLS2uHldDL99aQjiGC4ZOi/WnVz9kAAsOmOujQ9UdumQWlSWGLL171syRGGcop35tXrM8a/0zZlo0DWybHvZcLLNU0245HF1y2L0dUMLe2BJHga2JA3PKVk2oaOwepU4P7yN3UKrRWype7TFWjNo9WFBvw4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=GKDN80bb; arc=none smtp.client-ip=209.85.128.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="GKDN80bb" Received: by mail-wm1-f49.google.com with SMTP id 5b1f17b1804b1-413ffe7ee4eso9530235e9.2 for ; Fri, 15 Mar 2024 14:47:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710539249; x=1711144049; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=MeHDzWWTsxVr3uyxIAv6b8+tPYujO+vm7VOvv74Dnh8=; b=GKDN80bbW5BFep9giyGOC4LDshehC8jhHRWQXF7YzFSHAeDgbrn8AU1So/ASwYNbsI 8zFLohpvx+oAipHQzXuoK08BzmN6Xxpoc75Mj9AsJfn1TDtE18ibfr7tblMGUjhUHTPU N5GmAWLEm5XAc2Xr/MxZzl+DAUmxB/mcevhyU905604sHr2fr50v12n3McA9+8Dj7xbq vUWSLqdoWi8t+bCEwA+K9ioUC0RJ8pC9o/AdmAku3Qy55I0IOcwfSzzmA+GPR7v7GbAq uBXEnpcu/DCEX1VqIk9265jpZsnKkdtafAWMBLqX2vhAVbcWJujLk/aJ5BW9TEB+wblr YVhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710539249; x=1711144049; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=MeHDzWWTsxVr3uyxIAv6b8+tPYujO+vm7VOvv74Dnh8=; b=fQB+odIo3TTVNV9wwYQBUqA002VUBiwgRD00yx0RbeqwEt7ajSwwwHEwZCetnauCsp 7RJH5qTl7cRnS+10D1q1g0Tj06ysoAZJXsvufeLTSi+FlDTbTo7Vhel40hD0J0GqZCdR 4XGQjmmhxus1na1Z2yEva9DZYb/zQT6ZXXzXMSYrj/mmEka43/gYCcMVmocLfiFV5sIb mCaSbwk5ZOdB0AjXvVXGwLSAkzWyJT8GwBTq6urVVaABrao2ZN1AS0dq+lX+zyT7YkRu AsolsXFxZBq0Q3XU27dtffvx20+R90Qo5xJus042mzO1pPxe+pIYBfC4/PdP26KBJcq8 uQKg== X-Gm-Message-State: AOJu0YwcNuH/LPctYk0WRH/dfcBDlg1oYUfMVBb7dxFIiNIniu9mRGxJ gZ6QUzJIketqHpuB8iwJ5bw1bcqYIwi6w8dOgVTypnxltin3FBAbw2PYEqWD X-Google-Smtp-Source: AGHT+IE91kXhuVUkZOjvalzr71aYJbhBjrS8DFUXyyFB+i/qgciYFSupQ2I490fhIdJk1+LS6YKmMA== X-Received: by 2002:a05:600c:310d:b0:413:2c11:f795 with SMTP id g13-20020a05600c310d00b004132c11f795mr4835924wmo.39.1710539249307; Fri, 15 Mar 2024 14:47:29 -0700 (PDT) Received: from 127.0.0.1localhost ([185.69.144.99]) by smtp.gmail.com with ESMTPSA id m15-20020a05600c4f4f00b004130c1dc29csm7040881wmq.22.2024.03.15.14.47.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Mar 2024 14:47:29 -0700 (PDT) From: Pavel Begunkov To: io-uring@vger.kernel.org Cc: Jens Axboe , asml.silence@gmail.com Subject: [PATCH 3/3] io_uring: clean up io_lockdep_assert_cq_locked Date: Fri, 15 Mar 2024 21:46:02 +0000 Message-ID: <3c7296e943992cf64daa70d0fdfe0d3c87a37c6f.1710538932.git.asml.silence@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: io-uring@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Move CONFIG_PROVE_LOCKING checks inside of io_lockdep_assert_cq_locked() and kill the else branch. Signed-off-by: Pavel Begunkov --- io_uring/io_uring.h | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/io_uring/io_uring.h b/io_uring/io_uring.h index db6cab40bbbf..85f4c8c1e846 100644 --- a/io_uring/io_uring.h +++ b/io_uring/io_uring.h @@ -119,9 +119,9 @@ enum { void io_eventfd_ops(struct rcu_head *rcu); void io_activate_pollwq(struct io_ring_ctx *ctx); -#if defined(CONFIG_PROVE_LOCKING) static inline void io_lockdep_assert_cq_locked(struct io_ring_ctx *ctx) { +#if defined(CONFIG_PROVE_LOCKING) lockdep_assert(in_task()); if (ctx->flags & IORING_SETUP_IOPOLL) { @@ -140,12 +140,8 @@ static inline void io_lockdep_assert_cq_locked(struct io_ring_ctx *ctx) else lockdep_assert(current == ctx->submitter_task); } -} -#else -static inline void io_lockdep_assert_cq_locked(struct io_ring_ctx *ctx) -{ -} #endif +} static inline void io_req_task_work_add(struct io_kiocb *req) {