From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 43F8CC77B75 for ; Tue, 23 May 2023 21:37:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238622AbjEWVhV (ORCPT ); Tue, 23 May 2023 17:37:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34578 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229884AbjEWVhT (ORCPT ); Tue, 23 May 2023 17:37:19 -0400 Received: from mail-pf1-x432.google.com (mail-pf1-x432.google.com [IPv6:2607:f8b0:4864:20::432]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 96765126 for ; Tue, 23 May 2023 14:37:17 -0700 (PDT) Received: by mail-pf1-x432.google.com with SMTP id d2e1a72fcca58-64d3578c25bso5121b3a.3 for ; Tue, 23 May 2023 14:37:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1684877837; x=1687469837; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:sender :from:to:cc:subject:date:message-id:reply-to; bh=VO6eLPU/aA233thOtId6HlTxErgTCHCdwyM9bTKsmZk=; b=iuQxrhXE9Bupo9hGLnd39Ks6KE5M1W+KY/nOLwboBl9xB/yUF+a9HiogBfwxYNBY3o YVMxop0Dv5Pq3mI4ywtXKtJJ1EiYS9qOuZGhy8ACXpQZtwfR2Dr+BcU//aWZ62tcBQ2k P9ei5/z7sKRQ/YSMCwU8devVd2JLG8yhevJ7lV86+T9DhPegiZCeDB2tDXQtXoyl0IDM sjQI8pW7IA5pZ2ILYHuQCNtsvhlAtw9H2X0uBPG33jxI5kHLwkpgNikm3XvBJCsVjp7w +ZY6dEdIEsZZsKCgXrLLpzQFw252YeWZjCy3P3YpiAo+cME2OZTMDt59GHqO5uQLOOl1 VHYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684877837; x=1687469837; h=in-reply-to:content-transfer-encoding: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=VO6eLPU/aA233thOtId6HlTxErgTCHCdwyM9bTKsmZk=; b=RSzX5YWdZl9O+KAwf2wpDCiun8zM0RnvmGY2ihnfrZYZrq3jVVk7M8cSc2MTEM+2JQ 3klpd9JXDI/yp6IZKp+zyTR4rUtgrgQuwkHtMQIRb1/VAJDTAf9JzGm9MCfXSK+aj+N5 wbfhNDH2QG8z6CpTeOCchZXs1gb+onB7GxE5Or7Dlk3gkpNXGb/Pkwc9jSCRLvwW4scl cOePfb+Zd31kwitzjc1/G8ijpuEJp4fr8JXk+UVaFd2my/4Y1ueVogNT/YBFWZcxjI2d K20aAYyvZ/GjYyPCz9XCWfc1Hp48AmHMb/nIJp3Uaoyb/idhyNvAKos4gZvC3uMVyCPN UG2w== X-Gm-Message-State: AC+VfDynB8TVhfGrva4rjz409jDVE439jBlAHfWn+Bc3SAVgz2YIKXBP +kEAD1QwmpJJRAhVIXDNLuk= X-Google-Smtp-Source: ACHHUZ7UPjE5UqO6gHP6XwMr57d+KMb5iZkIqTVrHAKugXgIlKCfQ/xdt/6ornZbMPmwBp/9hf2Nzg== X-Received: by 2002:a05:6a20:8e15:b0:10d:b12:cc9 with SMTP id y21-20020a056a208e1500b0010d0b120cc9mr129279pzj.24.1684877836870; Tue, 23 May 2023 14:37:16 -0700 (PDT) Received: from localhost ([2620:10d:c090:400::5:7a1e]) by smtp.gmail.com with ESMTPSA id w124-20020a636282000000b00528e0b1dd0bsm6508891pgb.82.2023.05.23.14.37.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 May 2023 14:37:16 -0700 (PDT) Sender: Tejun Heo Date: Tue, 23 May 2023 11:37:14 -1000 From: Tejun Heo To: Lai Jiangshan Cc: torvalds@linux-foundation.org, peterz@infradead.org, linux-kernel@vger.kernel.org, kernel-team@meta.com, joshdon@google.com, brho@google.com, briannorris@chromium.org, nhuck@google.com, agk@redhat.com, snitzer@kernel.org, void@manifault.com Subject: Re: [PATCH 03/24] workqueue: Not all work insertion needs to wake up a worker Message-ID: References: <20230519001709.2563-1-tj@kernel.org> <20230519001709.2563-4-tj@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 23, 2023 at 05:54:10PM +0800, Lai Jiangshan wrote: > On Fri, May 19, 2023 at 8:17 AM Tejun Heo wrote: > > > + pool = pwq->pool; > > + > > /* > > * If @work was previously on a different pool, it might still be > > * running there, in which case the work needs to be queued on that > > * pool to guarantee non-reentrancy. > > */ > > last_pool = get_work_pool(work); > > - if (last_pool && last_pool != pwq->pool) { > > + if (last_pool && last_pool != pool) { > > struct worker *worker; > > > > raw_spin_lock(&last_pool->lock); > > @@ -1638,13 +1636,14 @@ static void __queue_work(int cpu, struct workqueue_struct *wq, > > > > if (worker && worker->current_pwq->wq == wq) { > > pwq = worker->current_pwq; > > + pool = pwq->pool; > > The code above does a "raw_spin_lock(&last_pool->lock);", and > the code next does a "raw_spin_unlock(&pool->lock);". > > WARN_ON_ONCE(pool != last_pool); > > can be added here and served as a comment. Yeah, this is a bit confusing. Added WARN_ON_ONCE(). Thanks. -- tejun