Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp1485015rbb; Mon, 26 Feb 2024 10:39:05 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVGgT1/BLHhPj02/9+QRBINPFDRurKP4sk14VYT81swoU9wQSqyVy8v5kSHPcQuj7CcDdUxjGfOQHcFlSWMxV6HkG7RbW75uutLESwtdg== X-Google-Smtp-Source: AGHT+IFCAmnbf8f+djT6NtxRYW9G0Sq1AZ/l3zkDkoNgSFR9qSfHtowlPvN3Ex0u1ZyURDmEqL3z X-Received: by 2002:a17:902:bb94:b0:1dc:a832:fe42 with SMTP id m20-20020a170902bb9400b001dca832fe42mr2169760pls.42.1708972745396; Mon, 26 Feb 2024 10:39:05 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708972745; cv=pass; d=google.com; s=arc-20160816; b=U3tZAX8gGunvZ3OsuDVbTwOZXdcuPDIOX+ImPO+D0WasKmzy8BjpSRgawHUMNP3Nap ohIExkE94EmNlycDCuGMXBqFsapZKPvwZhwRQ0SzqgWwyl/NUQmtBL/U1feq1GidApuF 2SiSA4G0HmgUoRACV58+pn2YrYFU6PVOE5Dywig1hgeNmOYHzadYMfPMcm2fH/3e48zN y5Ju8Ccq95amgf2pSZs/ptnAR6iXx8wkAYMunq17PYqg8PEmpxjN0c752rw4a16OONE9 JHyeV4sjLWI3Pvxuq5ZXtrDAVli19X7H2DQTgLbIN6Y3LnMuDaqswmiNfrk1la/qAOh2 U8FQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:sender:dkim-signature; bh=3PnlJgZfLcS59z9QT2AxSLhFdZdPteoPLnCZaELPVAY=; fh=88OBbf+ocm4/AQTHFKIj999bk0ucwwNrXxOxSWjV0UM=; b=ZTfJZSh9bbO729WfNqH8X1fj4d5SdvPXdSk4YUoFjO9B/tYoLrPI7lbAHMvvhNOFL+ uy87DJDbKW7nPQ5bc+kPViSnkW2r0JwLHcennSJ5OVwpCVy/VXm+Z5u0wAyyRmspygL7 nfCCmipLIYXne7AWlOdfL8DPPy766UmP4jAnERGqvY67oxgTvTZMksAeVmc7pl4N/mVZ gOw8AUrjuph3tyOWhjdFzWMCwigR56tAUfW2R6eOBWuQI//9EdSvBUI6ylDPzn2jOaYC JqQLjx04buil63bEPX/nGc+/Jet3taxrYT9l4bsmvtDm4cl4Dg/KJ/WhcsJuETgVTRYe 96gQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=S82QXTn6; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-82145-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-82145-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id x12-20020a170902a38c00b001dca843f0bcsi11341pla.443.2024.02.26.10.39.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 10:39:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-82145-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=S82QXTn6; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-82145-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-82145-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=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 F11F628E645 for ; Mon, 26 Feb 2024 18:39:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2C59112BEAC; Mon, 26 Feb 2024 18:39:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="S82QXTn6" Received: from mail-pf1-f175.google.com (mail-pf1-f175.google.com [209.85.210.175]) (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 0CDAE1DFF4 for ; Mon, 26 Feb 2024 18:38:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.175 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708972739; cv=none; b=lF0apfkCNLvBW6p7Zb6KATlGGGqacfk2U5LOh0GT/WeT4AzIhMIQOJA14xKxbHf7Rqh+/CLWfqkg5A3X2/rI/AcnbLQChtalB+DIxxAVGuNl+EK9f3qDp6CruSJsmxi2rwc1Z+HIRZ2tjkjsKl+/vsWImvZebjDsjTXlFD6dIHg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708972739; c=relaxed/simple; bh=yAb85nx0BPxN93fLWrvELpTgUdlrq5dRvyxHvqfOuX4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=LEUUotmuiRXHW6anJ7cH2XAzguKtdDtZ13oHabH/1WLY2EblHvd8O/hiN/bBEDpzLoVDJpCuXym+CW6m7M42+2NTJs3lLHcrV/dRfoU+dArDyUcW6ILDp9+hhcX87B9nyw79dAgEHUopMsAQqdJzMuLlteERtsAS1PqmlsGEcsw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=S82QXTn6; arc=none smtp.client-ip=209.85.210.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pf1-f175.google.com with SMTP id d2e1a72fcca58-6e4e7e25945so1571486b3a.1 for ; Mon, 26 Feb 2024 10:38:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708972737; x=1709577537; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:from:to:cc:subject:date:message-id :reply-to; bh=3PnlJgZfLcS59z9QT2AxSLhFdZdPteoPLnCZaELPVAY=; b=S82QXTn6JYQKCYOAzvn7MwyauUm8yFjP+VX6oWaCPcSvBPRDO/z4csvB7qqYNvYp4c zf+VnZYiwbGiASZUUfMRHDBZT1yLagW8eJs+7RNduAmv9tKl7eWaulVxDk1SAGJ39MaH m8RTfAloZw47WN3MZXBerflSkvaLRjqVxP+xsn2HmpK2+XkCADDOEhvP3glpR6tTT1NS +W3JRxsWpKd1NgHpd0oDYpQZjJ9eqEJ72360Fw15CEz5o9IDvqpr42W50bLnj6zPH8BA fMCUGG4rCQ2QX9qvyF8vAA0k7eh5JI68xi20nBNqRajsnC4vkkvoqMMm2IfQUCfqbHrW Ntnw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708972737; x=1709577537; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=3PnlJgZfLcS59z9QT2AxSLhFdZdPteoPLnCZaELPVAY=; b=QzFxMcPMJvrxBoXhYAjCJzR6qM2i7hyiPt501vgOmyTCOVq/pR49amJRUpRwk27Rzi R0sEq95qPEFbVuTMXOyLQ2GMkjmzrAfCoZITa+NHefQQrf5LgNmQxmiueFH/x8eo/6xn Ipsz2D4Mk5HEYw+imupVY6R821vLuXQL01Agv6I1b0jtNzWSNXGwoI+J9gQX/2vEtBBr TJcSNVSJcf/7x3CbyLb8jX5Nn+xuAll+COqKkfs0iVH8x8p+onw04iL/IK9KJN1M7L0g U1AhkQZZct73IjyAH2eU/t2F70wMRcEeBIupEBqqHuGGASXh9dp+S4oCqsTbabo9nnWv HXow== X-Forwarded-Encrypted: i=1; AJvYcCX5uhVqqlY1NQncXyfCQfqwbgcj+FDf5duWFNkKRPKOdUYcPbaCXjnq3dQ/Ld6srm5XPxCwCBAhdarBpthtRoNmI0AdFQ8E1AoJIJVF X-Gm-Message-State: AOJu0YyW7+3e0FIOfN4WSEtRfIy2DuCJh4FCGrtGRHElVy+ze47H0yZE X/in9lMRSr/l7Eaue55fC71wPIHAvSZlFBjLXRbo1dQVrxwrv3xk X-Received: by 2002:aa7:99c5:0:b0:6e4:7a93:b627 with SMTP id v5-20020aa799c5000000b006e47a93b627mr7518618pfi.15.1708972737209; Mon, 26 Feb 2024 10:38:57 -0800 (PST) Received: from localhost ([2620:10d:c090:400::4:31e4]) by smtp.gmail.com with ESMTPSA id l64-20020a638843000000b005dccf9e3b74sm4306893pgd.92.2024.02.26.10.38.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 10:38:56 -0800 (PST) Sender: Tejun Heo Date: Mon, 26 Feb 2024 08:38:55 -1000 From: Tejun Heo To: Allen Cc: jiangshanlai@gmail.com, torvalds@linux-foundation.org, linux-kernel@vger.kernel.org, kernel-team@meta.com Subject: Re: [PATCHSET wq/for-6.9,6.10] workqueue: Implement disable/enable_work() Message-ID: References: <20240216180559.208276-1-tj@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Hello, Sorry about the late reply. On Thu, Feb 22, 2024 at 12:26:35PM -0800, Allen wrote: > I do understand the work bits, but I don't fully understand the > concept of colors > (work_color, flush_color). A swift overview of it would be highly appreciated. That's just to group work items for flush_workqueue(). Let's say there are work items which are queued in sequence, 1 to 8. Let's also say that there are three flush_workqueue() attempts which take place after work item 2, 4 and 6. Then, the flush colors A, B, C, D are assigned so that: work items 1 2 3 4 5 6 7 8 flush_workqueue ^ ^ ^ \-----/ \-----/ \-----/ \------~~~ flush_color A B C D and the flush_workqueue() code waits for its preceding colors to be drained to implement flushing. It's just a way to keep track of the number of work items in flight which were issued before a certain point in time. It's expensive to do that for arbitrary number of points in time, so it just has N slots for groups and calls them flush colors. This shouldn't really matter for the bh conversion given that everyone operates on individual work item. Thanks. -- tejun