Received: by 2002:a89:288:0:b0:1f7:eeee:6653 with SMTP id j8csp526720lqh; Tue, 7 May 2024 06:42:39 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXkSrI/9uCmnU7AHOs3IslyEyDW2Ahwt8mT246/v1UVmSyfHkFp8MyHZClsPQcEoIuQMdMLojW2KhBBbIUzpv9UojyDyun3Y1Apq4TCSQ== X-Google-Smtp-Source: AGHT+IF+zX97l3+fWVVMnjxeElCkB25zTOk+kDfy0qOvqlDwpdEW2etB++XWsblrV4r5yRIEkINZ X-Received: by 2002:a17:90b:124c:b0:2b2:9c3a:8cfc with SMTP id gx12-20020a17090b124c00b002b29c3a8cfcmr13805821pjb.11.1715089359085; Tue, 07 May 2024 06:42:39 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715089359; cv=pass; d=google.com; s=arc-20160816; b=PJOeqRyzKGl7m3bTMLQy9cDqrvsJAueCKXE6xFoa2e4i/NnJwB6yfWtBJv/o48J1UP woIUmfwSpV4T3Pqt2NBcRNUzFMZdxvKu1eowwtLigEvx7O60An+tCL4fdfMm/wwUDLzq yQgEyabEDgqFTYM82D4mjeTG98VWa6M/tdtz42AhkYNHns0T8pFHL+C7Rek56+ZmjMnE eVJ2QN8Zwb3pNH/ORybphXPLtPda5qYzYSCkLhsQHpbEcefzKEIxlsZ1THGzPap/60j6 JCMAl6+2J4qv6oZ2Uad5hCJPQJPPV1rs1hqMb/tNhfsAu715uYe2scXReITcteQoN1gl JSew== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=MFxMsf5ko3JpAlwfgW8Pyhp9O0KIdjFS3Z63HbqP8S4=; fh=MCoYP8uIPl65Xim5K92ZnBd7S3R8B4whxK/1IHrWXu0=; b=IWg+Y1cptpMEuIfFqNng2xl9USKBexw60ivZqFTpLxo2Y7Pdqn6GceDBfTXs7+SAfK U900UfqVk0/LW21jB9aR1Rl4eosG5z/Dq8DlMDVp8VNS2LeZ7wN9Fcz1SkQ213Xvscpn yRMXl4IGcHJjX94I6uWSizrS3Ernw4jUAS48oACLelvq6lH/QoKXjksEaqB0yLw1dAnV 6sbBvv0fum3PJAgrrVca+sfLdNVIqQFJllBRPDi66HnyqjWzh+ki+MK03amlnbDsED7o dHA8G2sqza5vGQi8Zp4BiA8aD2b9ZNgXGtLvghNqFFOUUtUT4r/V4vdXQgRastSNcwG3 dufQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel-dk.20230601.gappssmtp.com header.s=20230601 header.b=06xNZPG5; arc=pass (i=1 spf=pass spfdomain=kernel.dk dkim=pass dkdomain=kernel-dk.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-171434-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-171434-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id s2-20020a17090b070200b002b4a2136915si6452216pjz.35.2024.05.07.06.42.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 May 2024 06:42:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-171434-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel-dk.20230601.gappssmtp.com header.s=20230601 header.b=06xNZPG5; arc=pass (i=1 spf=pass spfdomain=kernel.dk dkim=pass dkdomain=kernel-dk.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-171434-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-171434-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 83BE1288D67 for ; Tue, 7 May 2024 13:36:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3111B15E216; Tue, 7 May 2024 13:28:51 +0000 (UTC) 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="06xNZPG5" Received: from mail-il1-f173.google.com (mail-il1-f173.google.com [209.85.166.173]) (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 3631E15E1FD for ; Tue, 7 May 2024 13:28:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.173 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715088530; cv=none; b=We9qmuNidcnI8jcD98Fijp+V2rkwN3LCA0vXWAe9xDBqlhp6cpk/pgMeGqMjcGIZ7NCYIxETh7liiz1tv64hmKygPYGfYwjgtUIO9t4Cupw9vg+lDbzo+UP5A4w2LRwuOf6rVFHk4ZIMtdOghfIAOEJzFJN5WnvPYrTq6bnaw7s= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715088530; c=relaxed/simple; bh=5w7dG/mRuXFY0HOjXJUszy9l9SlV5dibC5t6Y1Bibr8=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=gojlJ50yuNw1O9jYBk23oqKGqScTPTXLinRzeWl8IW33D3BB14dVzwd5nwB8Jp2OryLKEfF57sXBUJtyqMVLX15mFb/DPsyBTn3aAoCtaKleypNEc7nRQlJZVVori+xaeF47D7j8mw/FOdSaPyXPItaRHl2eycxbEpQRVDhCK3c= 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=06xNZPG5; arc=none smtp.client-ip=209.85.166.173 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 Received: by mail-il1-f173.google.com with SMTP id e9e14a558f8ab-36c86ad15caso557575ab.2 for ; Tue, 07 May 2024 06:28:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20230601.gappssmtp.com; s=20230601; t=1715088525; x=1715693325; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=MFxMsf5ko3JpAlwfgW8Pyhp9O0KIdjFS3Z63HbqP8S4=; b=06xNZPG5ZLO3TaqsdkSrJ0FQEVzJ4ls5oAA9Bc1EVrzwFrY4lHLmQaFj9vGaT5umeG 4DTcFEipYJumg849YS7sg1mWTFMNfZyNcd5Y5kIJvtu2aYojFMaB17aGhWwTC4gen+9E 5ek2YiDrbnGreIwUK8ou6c8Un6JCvAdcWGmbuwYILzBDJBKNq6Me8096I/3aONF5k4kG CHmXZSMGeBK7Ptx+mrU04fv75XsS6gBO7FL62n3Z1TPz6drm202xq/1u9MQmtQwEd+6i 8KdxzJ8qbBcAE9sbLI+IFm81FsHi7g63O+4TRM/FGMBXaZI3zDwrvwnLCHTYHnLySglV 5mGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715088525; x=1715693325; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=MFxMsf5ko3JpAlwfgW8Pyhp9O0KIdjFS3Z63HbqP8S4=; b=oCGlxmgMsaEMV7MMIM1n6SD2xYcDJAEHNxrUrz6XtDyBU2W+7g5lLrYBdMheQXdFDx vsqeyghVWAWPX5uTbb1VzBL/y6cXzoC0bS5TOMHN0Yfx1iCuvhZ7juJAhr8izAUhWpgp LI4Uhqc5yQ1T8ux3HJlDq8naVuxCv7DMqg1J8zuJY4Es/pqIY1U6FPT4nHldBl1nwSj1 8+dQJx0zGtkMNBGOG/5RDR0YhPMzc6D3wcP92xfekZ7uSsrdtKrLJQjI9vaJnosQeocr uSLMfzumm7uLwtXTIuoWQNMV90axrh4pIJDX8YhYqxLqQW9IGsj3B+Mkk9LiSto6UWiW UGCw== X-Forwarded-Encrypted: i=1; AJvYcCUuz+rJzTUVMLoew3fZBSxLoiTvC8Bul5/WmlkX9dZUjuXM/f54gwMwIELBhLVdNSZmCf5fR8FIr7Q65J2Ck89PDvAX/3ElCxFQnnBX X-Gm-Message-State: AOJu0YzqFda5mmrFd3fD5n6qKsyce6vrJT1FGo8gskOYRvKsLXBasHrA IWSEIU4LmQ2JEK3RQcd4KEPNahWIYp1c9yPbFcwUYAOvHvMCqdgamjNmqTJTqzs= X-Received: by 2002:a92:cdac:0:b0:36c:4b9d:7d99 with SMTP id g12-20020a92cdac000000b0036c4b9d7d99mr14788263ild.0.1715088525093; Tue, 07 May 2024 06:28:45 -0700 (PDT) Received: from [192.168.1.116] ([96.43.243.2]) by smtp.gmail.com with ESMTPSA id ds14-20020a056e023f8e00b0036c89e78f6csm1803622ilb.3.2024.05.07.06.28.43 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 07 May 2024 06:28:44 -0700 (PDT) Message-ID: Date: Tue, 7 May 2024 07:28:43 -0600 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] io_uring/io-wq: Use set_bit() and test_bit() at worker->flags To: Breno Leitao Cc: Pavel Begunkov , leit@meta.com, "open list:IO_URING" , open list References: <20240503173711.2211911-1-leitao@debian.org> Content-Language: en-US From: Jens Axboe In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 5/7/24 5:02 AM, Breno Leitao wrote: > On Tue, May 07, 2024 at 03:44:54AM -0700, Breno Leitao wrote: >> Since we are now using WRITE_ONCE() in io_wq_worker, I am wondering if >> this is what we want to do? >> >> WRITE_ONCE(worker->flags, (IO_WORKER_F_UP| IO_WORKER_F_RUNNING) << 1); > > In fact, we can't clear flags here, so, more correct approach will be: > > WRITE_ONCE(worker->flags, READ_ONCE(worker->flags) | (IO_WORKER_F_UP | IO_WORKER_F_RUNNING) << 1); > > Does it sound reasonable? Either that, or since we aren't just assigning the startup bits, maybe just use set_mask_bits() like Christophe suggested and not worry about it? -- Jens Axboe