Received: by 2002:a05:7208:20d2:b0:82:bbfa:f723 with SMTP id z18csp50369rbz; Tue, 7 May 2024 10:12:16 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWm8bV3vk+oJbJwGaTUk0heJmROA4Hp+LUvpDUsgy6UjQX58ygif666gC9DUBX0I1deV8+dEpfXiFNSZQsCx/p/I1BhvFUvLvVEpj0SFw== X-Google-Smtp-Source: AGHT+IEmS2gBfDuHb3PJMD5Rq0cYDOuIvJzyJskDjNtxJm+0sjOrKCLYM7+8Yd4nj5/MVjQRnX3U X-Received: by 2002:a17:903:120f:b0:1eb:6477:f2e3 with SMTP id d9443c01a7336-1eeb05a1723mr2724965ad.49.1715101935772; Tue, 07 May 2024 10:12:15 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715101935; cv=pass; d=google.com; s=arc-20160816; b=J1V/HRTFfInO/Irdfry/xskLphS+DJwqYH6gMOLOKe6WGaRxtXoNGmWHIY8fSUyrdu VEKbhJU6Aty42LNDOOBRt/qz/CvMRA86gs9Ah+izL0yDOZNL/oRc26E0YR1DDlZOWBbu xvE3r7PI0I5WV97CIyMkZ+9eXHA1Jq83dAPciTc/aViTmUpO8d2ezI2wzIg4275Z7++L nF3z7LuoJdN1tMTLlj6X3P0I778+RfiLqqjpuMm9wnrD9uk3eO+/fU3jhQHBYyqWTOm/ sGybkajfE7ECYTrElrsA8vTXaO0jO6ZO/0nD+rQNqTs6vD49KJ5DuKxLqPjdgI/oqOvo eFAQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:subject:from:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=eecUBrjzZFlKhop2/+Jd/2n9Y8uQHQJpZaSD3Xf2tZw=; fh=ajQBWZBZIyG+ysaWnpFSN1VtW34t09LL006j8u/dzUM=; b=wtd2muMAwazNTYtt6EXF7vP0V2ikef3PJJK00ZHad6nD4AGtvUGfV/paDbWRzLQQRa uIqMbeTi1L4ThflFEM7r6XNFPb2GWkN/h6+Y/Ecn4+gVm85KL3IG3HUoAMtkQyDPhUJI fAJ+qc6gd4prGgoBs/5MEi5eSoaxyg1GnJTX2hmNq87q58o5DID082c1d9MZgcLx7+0I DVY/HdSJNX/KoGcSh2mQXK31VYt0xL+HvTcvK//5FEfRF7+p+LOdj0iODUMHvcMPkwTp sPg95E0iAdWg8RtpBnHXUlsekSggQTIyUylwtGRggK/xyQ3j6P95CdrivF6BddxMVVjJ B0eg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=F7uOl27M; arc=pass (i=1 spf=pass spfdomain=wanadoo.fr dkim=pass dkdomain=wanadoo.fr dmarc=pass fromdomain=wanadoo.fr); spf=pass (google.com: domain of linux-kernel+bounces-171895-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-171895-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=wanadoo.fr Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id l6-20020a170903244600b001e4779c8002si7559352pls.122.2024.05.07.10.12.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 May 2024 10:12:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-171895-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=@wanadoo.fr header.s=t20230301 header.b=F7uOl27M; arc=pass (i=1 spf=pass spfdomain=wanadoo.fr dkim=pass dkdomain=wanadoo.fr dmarc=pass fromdomain=wanadoo.fr); spf=pass (google.com: domain of linux-kernel+bounces-171895-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-171895-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=wanadoo.fr 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 38E92285DAA for ; Tue, 7 May 2024 17:09:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C950816C84E; Tue, 7 May 2024 17:08:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=wanadoo.fr header.i=@wanadoo.fr header.b="F7uOl27M" Received: from msa.smtpout.orange.fr (smtp-71.smtpout.orange.fr [80.12.242.71]) (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 9A4B516C6A0; Tue, 7 May 2024 17:08:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=80.12.242.71 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715101712; cv=none; b=pULo1BMxpYO49OLnlgoBQSn3H8wrSHtJv64r/eNerVDVXMb1Y0LWHlkWAIrvJ/qPn3UHiJr+9Ecxd4uvBENiYFrleWlflOhLQiiIxBzddR44+mmafg51c/3giHLY3FsJwO0xhziSi9sJGXmvOPkp3tYbMWurX1t74oLh6KRHeC8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715101712; c=relaxed/simple; bh=YER7gzQN8vR+dUrNqJYh4yp9BQl12GcuPdIaBB/It4E=; h=Message-ID:Date:MIME-Version:From:Subject:To:Cc:References: In-Reply-To:Content-Type; b=LWQtKuFOqM2LmM6naweaLiF/pLe72Axmw3uDFK30gJ3qN5elFweg5IveawJgPac63KYJC0NeeqaLkodWX+2YNswx8+r5A/LxbUKs8QVAISOstmgxvYlu9g75+Jk3OGe7dHZ2ZJIvR6MtpK8u8YC8tHuNOgE7PjHr6l0xMjY7G3w= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wanadoo.fr; spf=pass smtp.mailfrom=wanadoo.fr; dkim=pass (2048-bit key) header.d=wanadoo.fr header.i=@wanadoo.fr header.b=F7uOl27M; arc=none smtp.client-ip=80.12.242.71 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wanadoo.fr Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=wanadoo.fr Received: from [192.168.1.37] ([86.243.17.157]) by smtp.orange.fr with ESMTPA id 4NmOsXZ4Obh6Q4NmOsmkDW; Tue, 07 May 2024 18:35:02 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1715099702; bh=eecUBrjzZFlKhop2/+Jd/2n9Y8uQHQJpZaSD3Xf2tZw=; h=Message-ID:Date:MIME-Version:From:Subject:To; b=F7uOl27MZLjpRbpqI/ges5e0txwnLxb+8Y/NjPRIKQqxtuknZkgkgafiD6oxCxGJb UaTReDfCCUUQuJx0vU3+fkaGcX8kEkD+2E4srW87D16Zio3q3hiv9YI6GxNVUkLljD P4JnWcyBkMdEprH+JWDEcSg3ulHHX5e+FKdajNKimaTQkpLUzm0j0bd3NeNrM9I9Dy K8pNXt7x3R98asKxlg5VDCHOWOWizDPnbpCHiKVqu6ChqnxZXtobYsx7f67Ez0vLDK +jciSdbiXjlQPP/5IH7Su+W5l0yshy41nITwIKYNDXbHjwr7PScpZzFT3FwBD75jGN /jK6leSYhQBBQ== X-ME-Helo: [192.168.1.37] X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Tue, 07 May 2024 18:35:02 +0200 X-ME-IP: 86.243.17.157 Message-ID: <7ce84a03-d682-45aa-a67c-b789e3e90499@wanadoo.fr> Date: Tue, 7 May 2024 18:34:59 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird From: Christophe JAILLET Subject: Re: [PATCH v2] io_uring/io-wq: Use set_bit() and test_bit() at worker->flags To: Jens Axboe , Breno Leitao , Pavel Begunkov Cc: "open list:IO_URING" , open list References: <20240507150506.1748059-1-leitao@debian.org> Content-Language: en-MW In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Le 07/05/2024 à 17:09, Jens Axboe a écrit : > On 5/7/24 9:05 AM, Breno Leitao wrote: >> @@ -631,7 +631,7 @@ static int io_wq_worker(void *data) >> bool exit_mask = false, last_timeout = false; >> char buf[TASK_COMM_LEN]; >> >> - worker->flags |= (IO_WORKER_F_UP | IO_WORKER_F_RUNNING); >> + set_mask_bits(&worker->flags, 0, IO_WORKER_F_UP | IO_WORKER_F_RUNNING); > > This takes a mask, no? I think this should be: > > set_mask_bits(&worker->flags, 0, BIT(IO_WORKER_F_UP) | BIT(IO_WORKER_F_RUNNING); > > Hmm? > Because of that: enum { - IO_WORKER_F_UP = 1, /* up and active */ - IO_WORKER_F_RUNNING = 2, /* account as running */ - IO_WORKER_F_FREE = 4, /* worker on free list */ - IO_WORKER_F_BOUND = 8, /* is doing bounded work */ + IO_WORKER_F_UP = 0, /* up and active */ + IO_WORKER_F_RUNNING = 1, /* account as running */ + IO_WORKER_F_FREE = 2, /* worker on free list */ + IO_WORKER_F_BOUND = 3, /* is doing bounded work */ }; yes, now, BIT() is needed. CJ