From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from stravinsky.debian.org (stravinsky.debian.org [82.195.75.108]) (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 63CF23595D for ; Wed, 11 Feb 2026 12:32:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=82.195.75.108 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770813169; cv=none; b=DUwZCTNcUazxxejWqUdyd1XQ36mqOMrUVSu87sG9HqdLQnGhBlutmYFpQ7IqxTz45smBvuuW9jrVJUJ99YmpyttVlTACDUWFykyjpAmIYtHpo1e+QV3XF7Q8qr43FAUVmNaTKQPMb7ZaKuFPGpij2RXfyrHlBseNGB7e5YZB4tQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770813169; c=relaxed/simple; bh=GJemNy6Ki2QA5V3h7PH87surwvD6XefdRUU/bYZ4Isc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=jC9halHsRce8pMuhGcUiMmW4sjAuU7/+nciZnHkVknpidLccm2ZSdGBMOEspFnzQZEITMWMfqu2PZKiTW0GpYYYgGnXN0r+pcT3V3lkzfbGtBIoX0bJ7greMOiKklMjdxUH88i6BtTF+22xYuKj3Kiy9lsIWrhTXKG+khkfQbYA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=debian.org; spf=none smtp.mailfrom=debian.org; dkim=pass (2048-bit key) header.d=debian.org header.i=@debian.org header.b=WLH1vfXX; arc=none smtp.client-ip=82.195.75.108 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=debian.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=debian.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=debian.org header.i=@debian.org header.b="WLH1vfXX" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debian.org; s=smtpauto.stravinsky; h=X-Debian-User:Cc:To:In-Reply-To:References: Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description; bh=eyHDShenyeYpvpIVQXSORsBn0Sb9ydGp35ahaTlKk+8=; b=WLH1vfXXOtKJzJBqibSLIgbGL9 MzgCRDWWP4GR/5kDds/qKauAI3/GNxFrrFnm+lmKOptF4JGzVLNXwZNqt1Ay7hT8Gl+xCBodO2YWs KP0BQAXnMkOskBjmoK5zlXGs5/Ln9TcT+3Z3OcOI8nEwAFaFXQHglsX6qbCWboSwMQr+6B/IWbKHU cTx/gb8PjrTTy4Obr4fynFkv38gyGFQKDs5LfgxAL0EwKcOS4roMsySvk8qFIxIMB8S9m+ImcRbzw N1GC5J3R3w9fZly8z6zwq84mNwH9hb/WT5WEbj07qYEVkrnzFoqzW0dxRE3efyW42K45blso8JxcB qSiAd6/Q==; Received: from authenticated user by stravinsky.debian.org with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.94.2) (envelope-from ) id 1vq9Od-00B22u-Af; Wed, 11 Feb 2026 12:32:43 +0000 From: Breno Leitao Date: Wed, 11 Feb 2026 04:29:17 -0800 Subject: [PATCH 3/4] workqueue: Show in-flight work item duration in stall diagnostics 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="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20260211-wqstall_start-at-v1-3-bd9499a18c19@debian.org> References: <20260211-wqstall_start-at-v1-0-bd9499a18c19@debian.org> In-Reply-To: <20260211-wqstall_start-at-v1-0-bd9499a18c19@debian.org> To: Tejun Heo , Lai Jiangshan , Andrew Morton Cc: linux-kernel@vger.kernel.org, Omar Sandoval , kernel-team@meta.com, Breno Leitao X-Mailer: b4 0.15-dev-f4305 X-Developer-Signature: v=1; a=openpgp-sha256; l=2206; i=leitao@debian.org; h=from:subject:message-id; bh=GJemNy6Ki2QA5V3h7PH87surwvD6XefdRUU/bYZ4Isc=; b=owEBbQKS/ZANAwAIATWjk5/8eHdtAcsmYgBpjHbcgG/l34DQUyH7MN7zmFTEWQ6ql/Ejd8GCn DxXLewIN7uJAjMEAAEIAB0WIQSshTmm6PRnAspKQ5s1o5Of/Hh3bQUCaYx23AAKCRA1o5Of/Hh3 bXHyD/4xK1UGcGP+PvrTxxiuF94Oyjm88y0isqSASjwXgQucX2Q1piRIEHlTZHwpjH1KldsyWlH lbdOcT5pQ6cDlTRTEH2qzk/m94Z5V2Vav4do6nTYfHePRjj3BNzZXNYY4bvtY9wWe6WNQuz1YLZ oY0yUb9NeCCEgI8Ddn5WBpECDLGh3G5UskS1FZ9H+WsEvRBr7GE8/HQRITCGdQB3/FR/af5hi1E lLcbibbHBv7UNE5BZckqGsHTOL8ky6Ca0pvZGq1Vk7x/O2Z+cQKsUHcmL5EUKt7oaiWSVYqEcA6 kqJP29Cg1rK9Mku7nlWLmP+5rocUIhls1KszPXhffAEINbvAGYQwzMRYEli916GD7nXkXE8e4HA b7ZvTE6uHc1/N7uFJ4/yKDE5AZoo8Y/BXeX3kmT7xLGbowb8jsCH3bufDWl3GRPKW1OYnQZOSpl Xnlimrw0pvwENYXgo9Db4UKm0T9UdJqUrU+UAj16DWJiCfvIKWoxDxSR4Pa8jn4hA5E/NzwlG/q WgacWLZo1NJeKoRy15UUty2nDL7qEi+RrJ3EA+1F5Py4W91fz6KmxgbWJgpUan97ckM1ETlRZlM tq1AhcYJtYq0ptfTPHmZ8oOaTaLp1aANxVIWFXpk+nPPQ3Uc4lWmwANcuVrvDQbkclaqgyzeAga 4cc7GQfsOOfRCTQ== X-Developer-Key: i=leitao@debian.org; a=openpgp; fpr=AC8539A6E8F46702CA4A439B35A3939FFC78776D X-Debian-User: leitao When diagnosing workqueue stalls, knowing how long each in-flight work item has been executing is valuable. Add a current_start timestamp (jiffies) to struct worker, set it when a work item begins execution in process_one_work(), and print the elapsed wall-clock time in show_pwq(). Unlike current_at (which tracks CPU runtime and resets on wakeup for CPU-intensive detection), current_start is never reset because the diagnostic cares about total wall-clock time including sleeps. Before: in-flight: 165:stall_work_fn [wq_stall] After: in-flight: 165:stall_work_fn [wq_stall] for 100s Signed-off-by: Breno Leitao --- kernel/workqueue.c | 3 +++ kernel/workqueue_internal.h | 1 + 2 files changed, 4 insertions(+) diff --git a/kernel/workqueue.c b/kernel/workqueue.c index b3ba739cf493a..e527e763162e6 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c @@ -3204,6 +3204,7 @@ __acquires(&pool->lock) worker->current_pwq = pwq; if (worker->task) worker->current_at = worker->task->se.sum_exec_runtime; + worker->current_start = jiffies; work_data = *work_data_bits(work); worker->current_color = get_work_color(work_data); @@ -6359,6 +6360,8 @@ static void show_pwq(struct pool_workqueue *pwq) pr_cont(" %s", comma ? "," : ""); pr_cont_worker_id(worker); pr_cont(":%ps", worker->current_func); + pr_cont(" for %us", + jiffies_to_msecs(jiffies - worker->current_start) / 1000); list_for_each_entry(work, &worker->scheduled, entry) pr_cont_work(false, work, &pcws); pr_cont_work_flush(comma, (work_func_t)-1L, &pcws); diff --git a/kernel/workqueue_internal.h b/kernel/workqueue_internal.h index f6275944ada77..8def1ddc5a1bf 100644 --- a/kernel/workqueue_internal.h +++ b/kernel/workqueue_internal.h @@ -32,6 +32,7 @@ struct worker { work_func_t current_func; /* K: function */ struct pool_workqueue *current_pwq; /* K: pwq */ u64 current_at; /* K: runtime at start or last wakeup */ + unsigned long current_start; /* K: start time of current work item */ unsigned int current_color; /* K: color */ int sleeping; /* S: is worker sleeping? */ -- 2.47.3