Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp2814682rwr; Fri, 28 Apr 2023 16:59:06 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6YOUcIMYiXiDmdXcuXh39+8GQaIPZwL5pDiTgpdgfpl2nwDiOcvWJt9vMmVN4qFJFHPa0N X-Received: by 2002:a17:902:ea02:b0:1a9:83c8:f7f2 with SMTP id s2-20020a170902ea0200b001a983c8f7f2mr8244685plg.2.1682726346569; Fri, 28 Apr 2023 16:59:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682726346; cv=none; d=google.com; s=arc-20160816; b=E3KJGZlS6lu3vvkwRutpF1Q4fsfgNQ4Ov6ijV+65NYuETISpPdA7zdjx2dmDrLW/KF lYzyh7HEXlBBaYPkoDwaMJtw4Qb3f9W9l/c8ohB7vzf0fqmnkg5T/wffnSUwvMhPGIhg W5wW681OvFIONR3rRhmtFKkRXR8siezzF50RKL36o55MflRHRkDWyTrBhp7EshQwjyB8 8Xx2luNj2bZhz7coP72BY0eN0Shj80riPULOLoSQEvf5Ymn9wZlqpkQRT8FCdaM1ILLF 0sE09VH9NZg66igE/0s4zlVlaynSWRafGsu/NDwoDZhqQgI5xYatPiIAhEDjDRyb+GAZ IamA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-disposition:mime-version:reply-to :message-id:subject:cc:to:from:date:dkim-signature; bh=F/acI7rL6nVN6DckJVkqXQVwlrehKxsuhzfM9wfgbCM=; b=OJvDeA1YSTOu/p9NW9YQB/RjZ8RXxIm2Na+fpHVLbc5u8WtPkXtfJ/n+BtJTR7IotZ 7kFgcfECU2iamnm14NXBvmmtO8HXs85OtHgnOajLGOFqwFdujIf9CorUwU9fmdMmvc9c hNYJuFeuydApdb70G45IdT/N0l50oAV28gxByMdGJ8Nc6cYrBpX/aQCk4fu+dVA6zWfA VHvy5vegpFbIF4x3eFfdugYPtKztcI4J2+dLNVFn5I/9HvJGjtNHAMCCSzwJobpKE1IY bZRE4BReH5/mHHu7VtCrikAZS3PJ2YQXhagnTtVU8f9m9cWrw+UMXWEDwlLcsYH/AYyJ eGRA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=a59f2r2Y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d9-20020a170903230900b001a63a2de59asi24645743plh.494.2023.04.28.16.58.52; Fri, 28 Apr 2023 16:59:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=a59f2r2Y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229848AbjD1XsU (ORCPT + 99 others); Fri, 28 Apr 2023 19:48:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40446 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347091AbjD1XsP (ORCPT ); Fri, 28 Apr 2023 19:48:15 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 56A7D5BAC for ; Fri, 28 Apr 2023 16:47:45 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 90EED60E93 for ; Fri, 28 Apr 2023 23:47:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 01B9CC433D2; Fri, 28 Apr 2023 23:47:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1682725628; bh=R5vn2ZgdnPfmCjY37PzWzk8rZPbh5zWmOOaRiO9280E=; h=Date:From:To:Cc:Subject:Reply-To:From; b=a59f2r2YAmrSaA2nUjozRUiwjqqIZoWWf93NShGnXPGNZLmgOKd6clkLcbJqBI9lP jWJqq8/kLswsCpsxuTje9qcuBCCVyE5ZyrYKnBh5VNVRLS5ZGOJuaNSkS+ayzeLlP6 drd73vOstaYzeDLS6x0ozNmRjKLvWQASFDUMGPY2btMEdtdzn8kHP6/hSLNnIWCCms XZN6U9ZD5wjgFF8V0YWn4fQv9xMwzjSi2m90iVVzJPQFQnwxVzmm4mOFXxRw6HeyQc P9ZbVAdeoA3a6ylrfaD9GgC8MEP1Vqjs+5xCNIHJmWZThwTz9WkL3wsLJKtIENBOi3 kKMb+ZqHV7XBg== Received: by paulmck-ThinkPad-P72.home (Postfix, from userid 1000) id 7FB4115404E8; Fri, 28 Apr 2023 16:47:07 -0700 (PDT) Date: Fri, 28 Apr 2023 16:47:07 -0700 From: "Paul E. McKenney" To: tj@kernel.org, jiangshanlai@gmail.com Cc: linux-kernel@vger.kernel.org Subject: [PATCH workqueues] Further upgrade queue_work_on() comment Message-ID: Reply-To: paulmck@kernel.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The current queue_work_on() docbook comment says that the caller must ensure that the specified CPU can't go away, and further says that the penalty for failing to nail down the specified CPU is that the workqueue handler might find itself executing on some other CPU. This is true as far as it goes, but fails to note what happens if the specified CPU never was online. Therefore, further expand this comment to say that specifying a CPU that was never online will result in a splat. Signed-off-by: Paul E. McKenney Cc: Lai Jiangshan Cc: Tejun Heo diff --git a/kernel/workqueue.c b/kernel/workqueue.c index b8b541caed48..2dd3308edc01 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c @@ -1537,6 +1537,8 @@ static void __queue_work(int cpu, struct workqueue_struct *wq, * We queue the work to a specific CPU, the caller must ensure it * can't go away. Callers that fail to ensure that the specified * CPU cannot go away will execute on a randomly chosen CPU. + * But note well that callers specifying a CPU that never has been + * online will get a splat. * * Return: %false if @work was already on a queue, %true otherwise. */