Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp1087458rbb; Sun, 25 Feb 2024 19:43:09 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCX8wOPAqolO95nJqTDqdrOnevPP/qVfbtLP9g1dY2wK3WuK8CAutcGpNRGmeC38C2HrXRCoKhkpPUZYC0mPCrOrH2EedZBcBiXElcEmiw== X-Google-Smtp-Source: AGHT+IHwIYi+axPIuHyL5f8yKqbC1adImx1VJznef6KwrX7dvB8TjfUsqwK0moW+vJl+tVwsXLfJ X-Received: by 2002:a17:902:ecc2:b0:1db:a0f1:0 with SMTP id a2-20020a170902ecc200b001dba0f10000mr6323154plh.28.1708918989280; Sun, 25 Feb 2024 19:43:09 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708918989; cv=pass; d=google.com; s=arc-20160816; b=0Spr7nNX7WAb//fwosAlecOJfxQxSi9Y5YJgF0F0avIeUVUAeg5SAjQ2dc/fEJNMOY TTk/rqVUQLLvS2hsqoIqqBMjeR3MaHxhiHPBmoaD7F7PoEXtu2JkM8RVZwauKZj2GSPs q2JFQX0djxwVs2/sjBNq7zI18LhUINtIlj+MrXoIw3ncc4ku2JBY1VoYW4U9RpjvGzZ9 xRe8HomfOQlKWRr3IeLYFxHezFyS3kHh8KgnIQhoYeiyLa23NSbDxPf48WPrzy/Fei/u FDa84QFq7AW/+nWXDSXpXdrwG2BaivPucYMMTSNDOt9PVJlHevBxtH6c3dMSW5kaKMLh NkHA== 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:feedback-id:dkim-signature; bh=SGcn/WKEFJ2cswi2g4Ma6SzZtBVZ1KQHA19AIyx9qjU=; fh=P0Y3yvbrELVwwh28fKIrXqJ5RuL0U3SRnREMTL1BXxo=; b=VF23NdpvI1r/vSpvPRD67Q5Lboae23RPBf+FNKhDr+Sl5AZLmk5fY/Di+hmBXFP2vZ 1pQfVM/S7LsmTc39RICzS9vDeusiWwfaWpraGFCfy4Pm2SHg+wwXs5+w83mHE8lOh0rb H9QXsASVvMi22KLeF+Cx16Ojmkoxw7wCDoKdEiBe+Q2i6AJ1Qz8H7FJ2J/jE/xh7K2Nv /a8BTugzuLcuRUt+CnkbCLymAUDo7s3WCaSXseaaNUcSwJD9OQCXvAjzYH6tV5z+YeyW UGzGV4UafWili6FQRHxTTrv+veQ9IvnMxFB98+Qyvogncre56sdvg07l99/b9/LbboHm FLlA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="KcEla/O3"; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-80476-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-80476-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id kd15-20020a17090313cf00b001d50ecf8686si3021343plb.520.2024.02.25.19.43.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 25 Feb 2024 19:43:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-80476-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="KcEla/O3"; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-80476-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-80476-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com 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 01864281FAA for ; Mon, 26 Feb 2024 03:43:09 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0CB6D1B80F; Mon, 26 Feb 2024 03:43:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="KcEla/O3" Received: from mail-yb1-f176.google.com (mail-yb1-f176.google.com [209.85.219.176]) (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 C72861B7F6 for ; Mon, 26 Feb 2024 03:43:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.176 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708918985; cv=none; b=fvavVMPgwCY3/XNseKZGT+MHjvKqdgF1lUAgrQ6RFlLN/NP157tcko+ywty1Ep+RJqitcM2kPauUY8lLZFg1Wus3sT7xTT+wugYzPSjtqwVmVbGUtUIfYPnP7MK11dVeLZzis05A8B3sNBqQx4i3wjHX6KNSAsv4YF86T1aA0zM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708918985; c=relaxed/simple; bh=Anlt2az+b7Dfd3siRvdJ1NVsMdWOr2QOiUscSVO/2tg=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=mGF7qBKw26SZ+SU5CtAD9hO4ErBokOHLfvhhkJBGsvsjX2WbtWkebTsMT4D4BLKVe9B9xjDIOX/NGdJDRCBCKhyDbXRDk1OBFfZYCpA0fVQxyDHKVaxu9xbTGA+9cKu0Jo4ogrYwfHBwxGPBGNHkMW+y/6Xk3dEd5xREJtYz+qg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=KcEla/O3; arc=none smtp.client-ip=209.85.219.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-yb1-f176.google.com with SMTP id 3f1490d57ef6-dcc80d6006aso2595282276.0 for ; Sun, 25 Feb 2024 19:43:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708918983; x=1709523783; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:feedback-id:from:to:cc:subject:date :message-id:reply-to; bh=SGcn/WKEFJ2cswi2g4Ma6SzZtBVZ1KQHA19AIyx9qjU=; b=KcEla/O3miiYBPNRJa8IniedQlQUXKZZdn9Vw+VmaCKFGlBoKAGNLxWjaH5H4kKxAa UrWZ0VU8GgM1+3FpujVRdiMgN3OlHE6ZF8Mx6VNldVjow3jyPM/nsZfip+zARN0aRpYi 8mb6XWQmxMWMKnC3/eCTpKtWwjaG/MXRgUQhzQF9YL62az+y2Rm91LsGRI4VRr0RMnLR kY71c8LPxx+LdUH2TfX689SVPz9pa1Tz2qXGlEivl2Db5LLbwTEbBk6oldeZvZdPzCJK 49HaKftS9oRUKIbR/84hsF82zrxbsTB4HpZJ8DEy3TKInsVrMnWsY0e6sfozpfWN6rnX 4D0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708918983; x=1709523783; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:feedback-id:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=SGcn/WKEFJ2cswi2g4Ma6SzZtBVZ1KQHA19AIyx9qjU=; b=SJQ/fvQrw63/SK0GPHv+a4PmSuHKKfC24JdVBO59yP+hdrlbai8RqbAAEwCSGDirHe N379vPwAx20KFY4Pm4jJImqG+SFC66ln0pEaR4+2AU5mjlfOoBxh4aISODuf71pocENC YWqnPwvoq7tuR+HIKWXsg1P8Xi68E3aMQQK7s98rtw8ueOAxjL+GntQvegcWgSSGQTxi LfiPSeSImktC6CtTPdcvmYGsOabibkFmI53oy2+JMWB+RU8PfsHaw6p7HC3c22HgXn4J VcFRuZ03oWd/9GhtyXOxedsCXCbsQX9v9M0M5EqQbn/buzWLv87hSk5x2Z8JuvBDPO58 Kqjw== X-Forwarded-Encrypted: i=1; AJvYcCVaLOYJof0SN9olrZLyPGj1irn9dTM+eYtSyqbC/X6/bVf9OyZV7IAJSvWItVVeEnjmRKCitrHkVyNX77tGgBojBhHWsl/XetJrMLAL X-Gm-Message-State: AOJu0YxZQ0MCVJp+6kMQAum4lccC+K+40q/XqrR2so/t3u6MLGOeXIub qiNKorYs/ai8VRMn1cKVeRfXxdPNgLpmmsiiRLCqLDmQx9ZZshwU X-Received: by 2002:a25:694f:0:b0:dc7:4c21:fbd5 with SMTP id e76-20020a25694f000000b00dc74c21fbd5mr3330448ybc.0.1708918982804; Sun, 25 Feb 2024 19:43:02 -0800 (PST) Received: from fauth2-smtp.messagingengine.com (fauth2-smtp.messagingengine.com. [103.168.172.201]) by smtp.gmail.com with ESMTPSA id x18-20020ac84a12000000b0042dcfeda05asm2029205qtq.21.2024.02.25.19.43.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 25 Feb 2024 19:43:02 -0800 (PST) Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailfauth.nyi.internal (Postfix) with ESMTP id E2A081200068; Sun, 25 Feb 2024 22:43:01 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Sun, 25 Feb 2024 22:43:01 -0500 X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrgedugdeivdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhepfffhvfevuffkfhggtggujgesthdtro dttddtvdenucfhrhhomhepuehoqhhunhcuhfgvnhhguceosghoqhhunhdrfhgvnhhgsehg mhgrihhlrdgtohhmqeenucggtffrrghtthgvrhhnpeeitdefvefhteeklefgtefhgeelke efffelvdevhfehueektdevhfettddvteevvdenucevlhhushhtvghrufhiiigvpedtnecu rfgrrhgrmhepmhgrihhlfhhrohhmpegsohhquhhnodhmvghsmhhtphgruhhthhhpvghrsh honhgrlhhithihqdeiledvgeehtdeigedqudejjeekheehhedvqdgsohhquhhnrdhfvghn gheppehgmhgrihhlrdgtohhmsehfihigmhgvrdhnrghmvg X-ME-Proxy: Feedback-ID: iad51458e:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 25 Feb 2024 22:43:01 -0500 (EST) Date: Sun, 25 Feb 2024 19:42:27 -0800 From: Boqun Feng To: Tejun Heo Cc: jiangshanlai@gmail.com, torvalds@linux-foundation.org, linux-kernel@vger.kernel.org, allen.lkml@gmail.com, kernel-team@meta.com Subject: Re: [PATCH 12/17] workqueue: Implement disable/enable for (delayed) work items Message-ID: References: <20240216180559.208276-1-tj@kernel.org> <20240216180559.208276-13-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: <20240216180559.208276-13-tj@kernel.org> On Fri, Feb 16, 2024 at 08:04:53AM -1000, Tejun Heo wrote: [...] > +/** > + * enable_work - Enable a work item > + * @work: work item to enable > + * > + * Undo disable_work[_sync]() by decrementing @work's disable count. @work can > + * only be queued if its disable count is 0. > + * > + * Must be called from a sleepable context. Returns %true if the disable count > + * reached 0. Otherwise, %false. > + */ > +bool enable_work(struct work_struct *work) > +{ > + struct work_offq_data offqd; > + unsigned long irq_flags; > + > + work_grab_pending(work, 0, &irq_flags); > + > + work_offqd_unpack(&offqd, *work_data_bits(work)); > + work_offqd_enable(&offqd); > + set_work_pool_and_clear_pending(work, offqd.pool_id, > + work_offqd_pack_flags(&offqd)); > + local_irq_enable(); Maybe local_irq_restore(irq_flags); ? Because in a later patch, you make this funciton callable in any context, so it may be called with irq disabled. Regards, Boqun > + > + return !offqd.disable; > +} > +EXPORT_SYMBOL_GPL(enable_work); [..]