Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp166396rwd; Mon, 12 Jun 2023 11:36:57 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4aDK6GxTeXyKB1TuvLKqXJZPTaQ+D3IAGvJ6D4gn3yd0223UNEgoGsQGYo+C3V/3o1ygiz X-Received: by 2002:a17:906:99c4:b0:977:4b64:f5e8 with SMTP id s4-20020a17090699c400b009774b64f5e8mr10595608ejn.57.1686595017531; Mon, 12 Jun 2023 11:36:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686595017; cv=none; d=google.com; s=arc-20160816; b=sO0GuHfgm6mdGBPl1OoVV7Ze1yo8FwTHaaHdtWkDjKX2kX8Wyr+c+SJIbxmaHFPazr pZbwMBmq8QwWcOCNiVCppxU1ah+1h+q9DKoWoJh16JWihPVqo4aiKuq923xaKPuplFyy q7BOkYxq4oNeCefweVJaJiJHFYSfagu/PosqAl6JNu+eK5r7+Oo6Ua5TgTUdcW4rRS/u tZdeS68fjMmJOi/c76hujssBrw4UlMQ3IX8t+0yRsGWWudFPQ+d7iMhU6Z38NUWciQBQ kwTfVT/fkvyCBjoOfhlHLNSErWYHpjzETjFrF+whiqF9FcoPZFeQgxwUK/P4vNIY9sMO jUXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:subject:from:cc:to :content-language:user-agent:mime-version:date:message-id :dkim-signature; bh=ArfEG/zwX+Qu50yqWsLLeIAObXJ440FdnIJFkcDTwak=; b=TWxveZYTC4ka5SiYJlEqqlBOUqm2wf8dE8dT0a5p894CYuEbePPdEs1kQM8qt8f9hT SjrFFql8xionoG9x7CnqeM5Xo1hOL9BCT8rYOd4D7jlO1W0xfKYE68orr2o4gjtg8g20 MX9wGiz+S/SZqI7MuQflFSNrtB6z9X0o/2A4L08HK8l4M9kCxQUO5I4JjjxnloJ8AafH RQkUVWVT3IRtD3KdWTpceSeEfRoqTX9FOXBuwUkzhcxpXEmerouCfgQ8UYZzJ1pc9m0K Iha5OjdWIKZ21sOLMn4QJBx01g8ifqfhx1Ag/LZtf7gbVDADZk1VHIXhId3vhWMNfi60 2ELw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel-dk.20221208.gappssmtp.com header.s=20221208 header.b=MLP11eaK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f26-20020a1709067f9a00b00977daa2f39asi5362122ejr.1028.2023.06.12.11.36.31; Mon, 12 Jun 2023 11:36:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel-dk.20221208.gappssmtp.com header.s=20221208 header.b=MLP11eaK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232499AbjFLSMM (ORCPT + 99 others); Mon, 12 Jun 2023 14:12:12 -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-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-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 regression") 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 = 0; - preempt_disable(); - current->flags &= ~PF_IO_WORKER; - preempt_enable(); kfree_rcu(worker, rcu); io_worker_ref_put(wq); -- Jens Axboe