From nobody Sun Feb 8 08:42:40 2026 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 50B8AC7EE2F for ; Mon, 12 Jun 2023 18:12:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235366AbjFLSMN (ORCPT ); Mon, 12 Jun 2023 14:12:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36816 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237238AbjFLSML (ORCPT ); Mon, 12 Jun 2023 14:12:11 -0400 Received: from mail-io1-xd34.google.com (mail-io1-xd34.google.com [IPv6:2607:f8b0:4864:20::d34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E7D5CE65 for ; Mon, 12 Jun 2023 11:12:03 -0700 (PDT) Received: by mail-io1-xd34.google.com with SMTP id ca18e2360f4ac-77af9ee36d0so25118539f.0 for ; Mon, 12 Jun 2023 11:12:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20221208.gappssmtp.com; s=20221208; t=1686593523; x=1689185523; h=content-transfer-encoding:subject:from:cc:to:content-language :user-agent:mime-version:date:message-id:from:to:cc:subject:date :message-id:reply-to; bh=ArfEG/zwX+Qu50yqWsLLeIAObXJ440FdnIJFkcDTwak=; b=MLP11eaKUEnWnr3tT1G+bXrAxvIdMysvDLDleTr5mkuPZ36uaDGL2Je1SVO4kE04V3 soI6QyDs6AeFA3069KRUJLtHcH2vjFA6dUvVAsChzuEhgInftIf5lu2bg8EepdHvJjKA Om6d0ekCWiPoud0ZKBplUDnOtgoBYHDfR0zB5FFYL95yaHDuCJEn9C3LuVUudjuheDp/ sJLBRsIED9B5UNHCMsKzPlZi9uZ/b/YrNFLea5gAsJWnda61ZV5DkQyQ4ub1btYKGT4u yx9GI8Ps0gzwM7IporZ1U+utTG6kQDy8VsyaFxbLSUZyWR/VpaNTHzcjNvX3kfXb/zHJ P7oQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686593523; x=1689185523; h=content-transfer-encoding:subject:from:cc:to:content-language :user-agent:mime-version:date:message-id:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=ArfEG/zwX+Qu50yqWsLLeIAObXJ440FdnIJFkcDTwak=; b=CjGvX1/l9Hu3fCco9NsAGeLj7GBS8nxRhhrPclWRw7/A+H77eO+nx/iJt5QHeD2ROe OF1ZdwkWqy2T0h4XlkHtPhMeTu22JGWEgtKgZS+2LU4NQcsHuW6Fc/JWHtlJcvmxgMet NH9rwERY04sjDKxpUhZ1h5bqBob4H+Ot4GlyQLI9sRq8L4GgblU6UaiI2FaRf9hzXzGD Gxa6dyy9mGXgtE73greLin/yVQLiOqBUgrG9TVzz0B6fRZbJbY6AbhKuSBFvu986UKR8 7vrCi5yas/C4uEvnvrwXMezQMc9G6jFdShydurluCmz0tH94l5rG8AYNHLlPXg8393Pz kK2A== X-Gm-Message-State: AC+VfDwFUGWuz2mZLx1rqw3ox4RTS+zA5xSx7Q7LWB0ZMXBhWJjlUcTe l8eeIDZaQ0xURNk3LVgGcAzZZQ== X-Google-Smtp-Source: ACHHUZ6ynp4ZRI2CJT+g4J7cX44RSKygn3bUSTJEdhwij4+cpgkRDSrDA9Oya0lzjLcgBwQ0SgVx3g== X-Received: by 2002:a6b:5810:0:b0:777:b7c8:ad32 with SMTP id m16-20020a6b5810000000b00777b7c8ad32mr6714667iob.0.1686593523175; Mon, 12 Jun 2023 11:12:03 -0700 (PDT) Received: from [192.168.1.94] ([96.43.243.2]) by smtp.gmail.com with ESMTPSA id z3-20020a5ec903000000b0077ac811b20dsm3352116iol.38.2023.06.12.11.11.57 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 12 Jun 2023 11:11:58 -0700 (PDT) Message-ID: <2392dcb4-71f4-1109-614b-4e2083c0941e@kernel.dk> Date: Mon, 12 Jun 2023 12:11:57 -0600 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux aarch64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Content-Language: en-US To: io-uring , LKML Cc: Linus Torvalds , Dave Chinner , Zorro Lang From: Jens Axboe Subject: [PATCH] io_uring/io-wq: don't clear PF_IO_WORKER on exit Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" A recent commit gated the core dumping task exit logic on current->flags remaining consistent in terms of PF_{IO,USER}_WORKER at task exit time. This exposed a problem with the io-wq handling of that, which explicitly clears PF_IO_WORKER before calling do_exit(). The reasons for this manual clear of PF_IO_WORKER is historical, where io-wq used to potentially trigger a sleep on exit. As the io-wq thread is exiting, it should not participate any further accounting. But these days we don't need to rely on current->flags anymore, so we can safely remove the PF_IO_WORKER clearing. Reported-by: Zorro Lang Reported-by: Dave Chinner Reported-by: Linus Torvalds Link: https://lore.kernel.org/all/ZIZSPyzReZkGBEFy@dread.disaster.area/ Fixes: f9010dbdce91 ("fork, vhost: Use CLONE_THREAD to fix freezer/ps regre= ssion") Signed-off-by: Jens Axboe --- diff --git a/io_uring/io-wq.c b/io_uring/io-wq.c index b2715988791e..fe38eb0cbc82 100644 --- a/io_uring/io-wq.c +++ b/io_uring/io-wq.c @@ -221,9 +221,6 @@ static void io_worker_exit(struct io_worker *worker) raw_spin_unlock(&wq->lock); io_wq_dec_running(worker); worker->flags =3D 0; - preempt_disable(); - current->flags &=3D ~PF_IO_WORKER; - preempt_enable(); =20 kfree_rcu(worker, rcu); io_worker_ref_put(wq); --=20 Jens Axboe