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 04CBFC4332F for ; Thu, 17 Nov 2022 19:45:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234007AbiKQTpM (ORCPT ); Thu, 17 Nov 2022 14:45:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45980 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234710AbiKQTpM (ORCPT ); Thu, 17 Nov 2022 14:45:12 -0500 Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 232FA87571 for ; Thu, 17 Nov 2022 11:45:11 -0800 (PST) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 52AA621921; Thu, 17 Nov 2022 19:45:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1668714309; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=NDaPeUx9EQCPAaJDsOlYHj6Ing0L3O816O783kommYk=; b=WsKF9pnu8T3/N671NiXsFac2Ad6Gt+8BmtP8k2DvQPKpAuF9UKF5fFFaWKWBFKO28xUsLM qVEFFgYMYoOY6rHOYxx7aSOBJgqRpIcrgmsH6L9UMqXu92YteGNae+iTI7g8B2yPgD2XEX oztFu6aZ3O7QTUl6XfwsQEZlmHSMryo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1668714309; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=NDaPeUx9EQCPAaJDsOlYHj6Ing0L3O816O783kommYk=; b=dQM65QY/uPfKE5r5r6ZlaDMQQwyCVm+dTP45aQTsdR0dT6z8KVR7R1TWi6/MhndXcNHd0z 26BOdD1gPyECxgCA== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id C5A9213A12; Thu, 17 Nov 2022 19:45:08 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 9R+VH0SPdmNrAgAAMHmgww (envelope-from ); Thu, 17 Nov 2022 19:45:08 +0000 From: Gabriel Krisman Bertazi To: Pavel Begunkov Cc: io-uring@vger.kernel.org, Jens Axboe Subject: Re: [PATCH] io_uring: kill tw-related outdated comments References: Date: Thu, 17 Nov 2022 14:45:04 -0500 In-Reply-To: (Pavel Begunkov's message of "Thu, 17 Nov 2022 18:47:04 +0000") Message-ID: <87r0y1wekf.fsf@suse.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: io-uring@vger.kernel.org Pavel Begunkov writes: > task_work fallback is executed from a workqueue, so current and > req->task are not necessarily the same. It's still safe to poke into it > as the request holds a task_struct reference. Makes sense to me. Feel free to add Reviewed-by: Gabriel Krisman Bertazi > > Signed-off-by: Pavel Begunkov > --- > io_uring/io_uring.c | 2 +- > io_uring/poll.c | 1 - > 2 files changed, 1 insertion(+), 2 deletions(-) > > diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c > index 94329c1ce91d..5a8a43fb6750 100644 > --- a/io_uring/io_uring.c > +++ b/io_uring/io_uring.c > @@ -1249,7 +1249,7 @@ static void io_req_task_cancel(struct io_kiocb *req, bool *locked) > void io_req_task_submit(struct io_kiocb *req, bool *locked) > { > io_tw_lock(req->ctx, locked); > - /* req->task == current here, checking PF_EXITING is safe */ > + > if (likely(!(req->task->flags & PF_EXITING))) > io_queue_sqe(req); > else > diff --git a/io_uring/poll.c b/io_uring/poll.c > index 2830b7daf952..5d4a0a4a379a 100644 > --- a/io_uring/poll.c > +++ b/io_uring/poll.c > @@ -214,7 +214,6 @@ static int io_poll_check_events(struct io_kiocb *req, bool *locked) > struct io_ring_ctx *ctx = req->ctx; > int v, ret; > > - /* req->task == current here, checking PF_EXITING is safe */ > if (unlikely(req->task->flags & PF_EXITING)) > return -ECANCELED; -- Gabriel Krisman Bertazi