From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F3F2C27B32D for ; Fri, 21 Nov 2025 19:05:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763751909; cv=none; b=CbNoXPvZuxrSA5wVLtZqM4Ysde6lDGx6+eTFX3ilhGlqCIabp/zRTsAmeLqYukWa4ZIeJNTcXLqzeRa6fA+4Z0xanxRqtNCxwdhd184hBs/8OQRrWIE1HASKxikXeWKMQEB7/x8b7A/v3GOZbwya1hWOPIaZR9NtTLCMU9Bg9Gw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763751909; c=relaxed/simple; bh=ovczpc8/YZakKzJYZ0fqNhExQMMlxStaf12MLDE2y8I=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=I5WvW0tY4vg0qrN2SppINJdk1IvyLE76AZ8jXWx7jxVoyUA0XZe6UK7MD2f0zqM+B8aULVLuPKVE16N9MI2RvhRutgkds4/H9wZp4wsZ1VahhsguG4TRfXhnsayIunmm2EAbJR7AG91XisOnatjFMGZAu4A+XXyw2gAPYBs+MZE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=sX3jN4wv; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="sX3jN4wv" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 49177C113D0; Fri, 21 Nov 2025 19:05:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1763751907; bh=ovczpc8/YZakKzJYZ0fqNhExQMMlxStaf12MLDE2y8I=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=sX3jN4wvqzRnMZvYygSQ0M/4+s/sPAU/DMLJ/67b3HJGDtRhoczr/BHHDHqo3sE75 nRqhUnta+wKCkPS4MrqnLx+WA+fs8tsm10XNdYKNfWX9UWdubne8GZzZYNc5zW1yPy xsMekY3ZWgdJZFlt4pDm67mtGTFfHKvQzl4XD8CJRt/eCriLRQd3dgb/4DTlZPbZnP 5hauB4WfHYqAtHIsx3RUKEEtz5CKyvNZ2qDay1bE8zPCtqRBKE3bOkUuiQ17m1vOaG 8CFL6gHovJjFMaRqA4/aXjPhjchfK/hf15pihFpistI9hYI9V6sZ0BH2OhP0IVRIs1 hjLXx1PGU3qjQ== Date: Fri, 21 Nov 2025 09:05:06 -1000 From: Tejun Heo To: Lai Jiangshan Cc: linux-kernel@vger.kernel.org, ying chen , Lai Jiangshan Subject: Re: [PATCH V3 5/7] workqueue: Process rescuer work items one-by-one using a cursor Message-ID: References: <20251121145720.342467-1-jiangshanlai@gmail.com> <20251121145720.342467-6-jiangshanlai@gmail.com> 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: <20251121145720.342467-6-jiangshanlai@gmail.com> > static bool assign_rescuer_work(struct pool_workqueue *pwq, struct worker *rescuer) > { > struct worker_pool *pool = pwq->pool; > + struct work_struct *cursor = &pwq->mayday_cursor; > struct work_struct *work, *n; > > + /* from where to search */ maybe: search from the start or cursor if available ... > + /* try to assign a work to rescue */ maybe: find the next work item to rescue > + list_for_each_entry_safe_from(work, n, &pool->worklist, entry) { > + if (get_work_pwq(work) == pwq && assign_work(work, rescuer, &n)) { > pwq->stats[PWQ_STAT_RESCUED]++; > + /* put the cursor for next search */ > + list_add_tail(&cursor->entry, &n->entry); > + return true; > + } ... > @@ -5141,6 +5169,20 @@ static void init_pwq(struct pool_workqueue *pwq, struct workqueue_struct *wq, > INIT_LIST_HEAD(&pwq->pwqs_node); > INIT_LIST_HEAD(&pwq->mayday_node); > kthread_init_work(&pwq->release_work, pwq_release_workfn); > + > + /* > + * Set the dumpy cursor work with valid function and get_work_pwq(). ^ dummy > + * > + * The cursor work should only be in the pwq->pool->worklist, and > + * should never be queued, processed, flushed, cancelled or even examed ^ examined I wonder whether this is unnecessarily verbose. Maybe just "should not be treated as a regular work item"? Thanks. -- tejun