From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ot1-f45.google.com (mail-ot1-f45.google.com [209.85.210.45]) (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 86AFD8635D for ; Mon, 2 Feb 2026 14:52:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.45 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770043934; cv=none; b=TcAY6Fd5LkfAr0uC4XMn2IG6uZnZK0WweVmuzONDV2TqQzVxvEifD82iNDvewenJMxg1o2yve0TMa7/MlX2+TbMLvty2LsqCY70h8UXI24MiBdQ2n7MqNIo8YLly1YGH/N1cvVrWc0chGkuL0DDISvRRVo2BEKhbTsK+GwCnoxs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770043934; c=relaxed/simple; bh=E94seAHQMwNegLWsMmbnXYdh94jwQKEpI6XpSo5nqc0=; h=Message-ID:Date:MIME-Version:Subject:To:References:From: In-Reply-To:Content-Type; b=bUbugfSCRVCkauBtwqQ66eGBrLH87G5Lg9Vdwfp24vIFY5uFNXeSkjLGfjkSFshPQ7n8IKvduV3OLZ0aok2WOaV2Go+JDlwul8b/sli9WUweeacCS6B2scbeE7jk9SY9DNRQKMlHK6l2LQnKA/+6BcO6/KOzwvEXN/lNz4RqbUc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.dk; spf=pass smtp.mailfrom=kernel.dk; dkim=pass (2048-bit key) header.d=kernel-dk.20230601.gappssmtp.com header.i=@kernel-dk.20230601.gappssmtp.com header.b=WR2u/SWf; arc=none smtp.client-ip=209.85.210.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.dk Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kernel.dk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel-dk.20230601.gappssmtp.com header.i=@kernel-dk.20230601.gappssmtp.com header.b="WR2u/SWf" Received: by mail-ot1-f45.google.com with SMTP id 46e09a7af769-7d189e5b05eso2221796a34.0 for ; Mon, 02 Feb 2026 06:52:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20230601.gappssmtp.com; s=20230601; t=1770043931; x=1770648731; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id:from :to:cc:subject:date:message-id:reply-to; bh=V4gLuY5Y57cQq4+OOEVjgP9kkY9Jsj+QHFveQowBo1c=; b=WR2u/SWfa8lXx0lABpF/dVrT00j5q7KxeuEJLcbKBnF+Gph2/SVXDQ0bxRrWOEg/dE +jJ6/bB4TuZjFnko1hWYtx6iOibJriYRyMSdOMaphVhB1rzPTrKqdMxFce1CCPzm0o9d Nq/Q4dG5M7BdOxWDdjD5fZs6CK5hBQPEjJ+Yq5ZsJrJRbCbZxlqKAgLPbfrafPJn7wug uvto8c7B6jTj6lIoCyTXaVqSazB1NIveyKrT5Uh8+OQFU2i3cdSNdENvMAuCC/DuY1Lk KwcZm9TEhZTkHiaa6AHqmeZuNNxGezo4lEJOnTF44/M9kK+4wYvWX031MRQskR0PZoAX AEdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770043931; x=1770648731; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=V4gLuY5Y57cQq4+OOEVjgP9kkY9Jsj+QHFveQowBo1c=; b=R2PAT6aODzD+e4H7AVxcm3lctpYQWsLcH16TXZm8sWm7QgZ3vmlhvjm0ORrEYpD6G5 /He9hMTncBsYuXZsGU09FiaHXO8bdX0sdGog/Ybdd9rYXBtwBkcP0ooKIFDXELPIC/aw T+TazHMvfTlm/MFMzB/Q6RXBe7pCtoYweX3T4m3FC1Gguak2SeW0uLtGv1W8C+hvZMXJ AyESSmXHHLwJ+SnNbdH7FVFdyHW39IxhFhRxh+2XaxfAvP3Q52BchDgXadVrwPbrmYcW guPSiklPcUANOYajPP6LoP+/BMDFL1b7QutQfmk+kzCB/AmAQA0wFK/RKqheCP3qq/G2 GlRg== X-Forwarded-Encrypted: i=1; AJvYcCV9J3x60ALOl8Qp/ebtA8upF2qsO2uCH+SX8FPAFH0Z0jmE0kt7AxU3u+htPur730dNSKp4oJ+clgYICJE=@vger.kernel.org X-Gm-Message-State: AOJu0YzwvtLJdvVzBNOvny4HfZX12Q4d/j/Bnuk4Ip0EQtvAUNMW208u vsAWzzESwSaM/QNsNWd4o3gF19ujj+bnlSv6BqsKGvQmd87DQVdaIvVukShLs44L5YY= X-Gm-Gg: AZuq6aIA+uUksr6fTuQAgv6BwLsPvXs4m3goLfmuZnxms/bdzld+ycdRARvIppAs8Yj 97xC5BewQdEwVU241p7QlZUpTCbAdKqj6KUhi60gguLNN+MECI8HxRo0jeR7JAjTKqW2Tu3DVU3 wbX9nDW9NYi1XDFs7aH+YNXcYrgznmi7NsIUbryuxhp9W0r2vwnWK5SZfsOdjJOImN+hCjn02Yy YsZqovmxJwwj94N5KKcMuxeQ6gXYzFjVLPSpIbnjWgd1nl6TW5OrtknW33tglijj35V8axrZDK9 AEebG0z6+6CdSAjdS3Qy2pGyynQ0mg6FnLifw948Jm88ijvHJEidq1hBUC1GPH9rrYe5KELJqdb KCA8XiLWSgctc6EPLvcU/cKBe2TuFrlr0lIAFrGAxHqpb5rbm8XILtavUQ+ZOnyBZN+nAIR6jXy 1Ki9NyPjSCWZJ2q1Da1Y4VufxrUcxdjXChdvEzzyAbVv78JGpbh3EqOu6hgmn6atrL/fNJRw== X-Received: by 2002:a05:6830:2aac:b0:7d1:a051:9c9c with SMTP id 46e09a7af769-7d1a5140bcdmr6054138a34.0.1770043931498; Mon, 02 Feb 2026 06:52:11 -0800 (PST) Received: from [192.168.1.150] ([198.8.77.157]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-7d18c7cf4f0sm10473506a34.15.2026.02.02.06.52.10 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 02 Feb 2026 06:52:10 -0800 (PST) Message-ID: <25ecadef-7556-490c-a85f-4a4494dd029d@kernel.dk> Date: Mon, 2 Feb 2026 07:52:10 -0700 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v1 1/2] io-wq: add exit-on-idle mode To: Li Chen , Pavel Begunkov , io-uring@vger.kernel.org, linux-kernel@vger.kernel.org References: <20260202143755.789114-1-me@linux.beauty> <20260202143755.789114-2-me@linux.beauty> Content-Language: en-US From: Jens Axboe In-Reply-To: <20260202143755.789114-2-me@linux.beauty> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 2/2/26 7:37 AM, Li Chen wrote: > io-wq uses an idle timeout to shrink the pool, but keeps the last worker > around indefinitely to avoid churn. > > For tasks that used io_uring for file I/O and then stop using io_uring, > this can leave an iou-wrk-* thread behind even after all io_uring instances > are gone. This is unnecessary overhead and also gets in the way of process > checkpoint/restore. > > Add an exit-on-idle mode that makes all io-wq workers exit as soon as they > become idle, and provide io_wq_set_exit_on_idle() to toggle it. Was going to say, rather than add a mode for this, why not just have the idle single worker exit when the last ring is closed? But that is indeed exactly what these two patches do. So I think this is fine, I just don't think using the word "mode" for it is correct. "state" would be a lot better - if we have all rings exited, then that's a state change in terms of yeah let's just dump that idle worker. With that in mind, I think these two patches look fine. I'll give them a closer look. Could you perhaps write a test case for this? -- Jens Axboe