From nobody Sat Jun 13 07:49:54 2026 Received: from mail-wm1-f50.google.com (mail-wm1-f50.google.com [209.85.128.50]) (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 4D06E3FFAA6 for ; Fri, 8 May 2026 15:03:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778252624; cv=none; b=hjU1dbEwAGxF8qNOdy9N03GNeqU3M6HW/7/Osn0yzR4/MYzpk1E/i9b7RzSQWuuUakuFb5/YlEXkIQo7FZViOfnzP/micMY4Hl1GolJvfph2zmAn21+wfoIJrF0FadFt/0BHjjXpsP3qdQyR6D+OjlRhyIlDSv36bh4x5v5+h3s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778252624; c=relaxed/simple; bh=dEFEWz3grYsJ3xFfPv2w0LqS/B3a113eXpTHuU1Bfow=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=UfrEuoZQtoeKMw0I3lYw6AoRF+WON9o+AVmOfFefkg9dL5xKDtyTwI02pcsOAkPvNQkAWmXiDgvb5L3oCTzOvRoe59vuSCZyuO4BmDDpIP32hfYllmVu48MMszl2SnKmx7/fRX5siAqMAyRAWGhgqyUr1xGhBGuPvEI+Lh6Fdto= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b=NVwdU1qQ; arc=none smtp.client-ip=209.85.128.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="NVwdU1qQ" Received: by mail-wm1-f50.google.com with SMTP id 5b1f17b1804b1-4891e86fabeso25331295e9.1 for ; Fri, 08 May 2026 08:03:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1778252621; x=1778857421; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=K1nwqrFtqGULq78/Os8+Xaynrz1dC0zWHqq0+EOjT34=; b=NVwdU1qQDwvhRjbVAQOxOq9NWbBJdSE6hoSKzmHC3zYc5MPloLUXZTfcSPq1YirXwh banFrouyoYJ2IJfDlJCOwkQ9tZTcFgz+hfNm3tqiuvixavb8yf+X61QxGGVn2VGSOSiQ A2UyT57iKU77l0bY+auErPxj6K4r21GJ77UMF7ORvB6SeyovoBWF7OLdHd64wzfLy3H0 hgMaPKF+GWFm98RNALbuj1IdafyHMh5DKGnLQKLvIY9QNRimxYeZf4rMiWwoZPVvml3B aHuFMkb+w0DODbjqgMeogCfwsjoEn61HKWrY5F5typWUtCUTeIS8Wp5c0gVMEcUXPuPr fCBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778252621; x=1778857421; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=K1nwqrFtqGULq78/Os8+Xaynrz1dC0zWHqq0+EOjT34=; b=QyLfe/vWkWZEO+H4eKgL0lE8m49KGutrZrQ2ltJZf2Q6MFCxBNCtx0VsBponoIrbnY SGhjC+jvw94rJxNO21dLu0f7m7T04cWAO6uG9VWF2mxODTvraFOQlPgeDOosXVATy4tV KJiu1XhZw9EZNI+ML+weIRCTwX/QbJD1dPki/FCb6KU6O9iuYldroM1CaurLbLKVW3cY VQP/99RkRj64Yvee2MdRcgUXpLGJOAtRwIcLNG7lTycZk8ERQ1VutoqTb2y0koIjJYJk 2TiV5nzcs8boQrqhDzftvY3+8/CLx/FPNDdgNehQSA+l7EHl/tCHkSLm0BkqOpzpAm6z etaw== X-Gm-Message-State: AOJu0YzdeYnmkpHr9MNcgzuG/t7vLybW9rorcsbaHuvozaE7qIa+mbV4 y3+tUX5iwa2yQXxJGvsDTpQAKUWFHwjjgKYkA1GYle+EqYctXDJUCZefFwaP1eWPo1RplZMBYNm xX1LWfoc= X-Gm-Gg: AeBDiesBnQrH+mxm+AfotaOoO6Skod8X/ZcXpRCF48Uhswtzbn2m+h0eZTZLGukVMAT RrG1MeEQJqEfQi+KK9/Yyaev2BHl5+kjJutrnam8hvZqHA6U4mDznwp8IriYJN2UKsMNj35hMIu +ASX+XJtduoOIFz9NDkov4wau/ZJTOrLD3IN40XPI5odo6RAwNyhjnQ3Ky/A8LQxsszg3yRa4Ij 2V3AfheYBHYy2Wl1RvJ53EzZDV6BNj6of8egHrLAIwRnIq89OtzW/dsvHCNI0lHfhE3rQ9TRy1P k8lfpJ5X7t3qgWbZNs2nCeH/mKIbmx5n5guSlN/8VpIcganoWKiuEhAp/0OwhC0rtd+55FWX6nK 0ATR0D7SwzXVgS5fNqZfDGvm9be9U2uqEXmtZThikQyJ/6UNWJB6Qhi6Vhl4nWtD6xGuAxYxIYZ AwMbNqIr//NZccX8lzZz4WGb71ibG1rLsWQx/BKmC7dNFm8Oo= X-Received: by 2002:a05:600c:3151:b0:48a:7605:751e with SMTP id 5b1f17b1804b1-48e51e0837amr199168805e9.4.1778252621369; Fri, 08 May 2026 08:03:41 -0700 (PDT) Received: from localhost.localdomain ([2a00:6d43:105:c401:e307:1a37:2e76:ce91]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-45491ca2fd6sm5262918f8f.30.2026.05.08.08.03.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 May 2026 08:03:40 -0700 (PDT) From: Marco Crivellari To: linux-kernel@vger.kernel.org, linux-sound@vger.kernel.org Cc: Tejun Heo , Lai Jiangshan , Frederic Weisbecker , Sebastian Andrzej Siewior , Marco Crivellari , Michal Hocko , Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , David Rhodes , Richard Fitzgerald , patches@opensource.cirrus.com Subject: [RFC PATCH 1/2] ASoC: cs42l43: Move long delayed work on system_dfl_long_wq Date: Fri, 8 May 2026 17:03:18 +0200 Message-ID: <20260508150327.351779-2-marco.crivellari@suse.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260508150327.351779-1-marco.crivellari@suse.com> References: <20260508150327.351779-1-marco.crivellari@suse.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="utf-8" Content-Transfer-Encoding: quoted-printable Move long delayed work on system_dfl_long_wq Currently the code enqueue work items using {queue|mod}_delayed_work(), using system_long_wq. This workqueue should be used when long works are expected and it is a per-cpu workqueue. The function(s) end up calling __queue_delayed_work(), which set a global timer that could fire anywhere, enqueuing the work where the timer fired. Unbound works could benefit from scheduler task placement, to optimize performance and power consumption. Long work shouldn't stick to a single CPU. Recently, a new unbound workqueue specific for long running work has been added: =C2=A0=C2=A0=C2=A0=C2=A0c116737e972e ("workqueue: Add system_dfl_long_wq fo= r long unbound works") Since the workqueue work doesn't rely on per-cpu variables, there is no obvious reason that justify the use of a per-cpu workqueue. So change system_long_wq with system_dfl_long_wq so that the work may benefit from scheduler task placement. Cc: David Rhodes Cc: Richard Fitzgerald Cc: Signed-off-by: Marco Crivellari Reviewed-by: Charles Keepax --- sound/soc/codecs/cs42l43-jack.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sound/soc/codecs/cs42l43-jack.c b/sound/soc/codecs/cs42l43-jac= k.c index 3e04e6897b14..934666295ee3 100644 --- a/sound/soc/codecs/cs42l43-jack.c +++ b/sound/soc/codecs/cs42l43-jack.c @@ -805,7 +805,7 @@ irqreturn_t cs42l43_tip_sense(int irq, void *data) if (priv->suspend_jack_debounce) db_delay +=3D priv->tip_fall_db_ms + priv->tip_rise_db_ms; =20 - queue_delayed_work(system_long_wq, &priv->tip_sense_work, + queue_delayed_work(system_dfl_long_wq, &priv->tip_sense_work, msecs_to_jiffies(db_delay)); =20 return IRQ_HANDLED; @@ -932,7 +932,8 @@ int cs42l43_jack_put(struct snd_kcontrol *kcontrol, str= uct snd_ctl_elem_value *u snd_soc_jack_report(priv->jack_hp, 0, 0xFFFF); =20 if (!override) { - queue_delayed_work(system_long_wq, &priv->tip_sense_work, 0); + queue_delayed_work(system_dfl_long_wq, &priv->tip_sense_work, + 0); } else { override--; =20 --=20 2.53.0 From nobody Sat Jun 13 07:49:54 2026 Received: from mail-wr1-f45.google.com (mail-wr1-f45.google.com [209.85.221.45]) (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 F16C63FFAC9 for ; Fri, 8 May 2026 15:03:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778252626; cv=none; b=cj2AR35XNmtM5Q5LVaIiTefuYKwg7aTim3au58Ht8Joi6fjgpt6OAlosuYjLY35yey9R7Bf7gjw+Stm4yAiNceWLf3pTM8FfPKq7TqORXZXcJDfHTRlDq2GReXsd9n/pVdzEVxs7JPKxK1IaCEW1O2dupgaYkdrQWS47T2c/xX0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778252626; c=relaxed/simple; bh=TH9dczhTjQEhar2KYDg+eYkeLByvqUVPgRCcViqkALc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=I3FrNq00T7vHof0c7rQ513U1iFh0JTrU+UDsdxS84b52S3RHLJ1F68JMUaO6VRTHLWhOa/LCwQR3Jgovu7DN9bQVtKZjhnYGsbgAgFhuW9r0K8Q0ejXAMbDSMdWkjg+ruXCsGfLPrJmWL8ekdI91QxNw3XIhMsW/q0DWOoVgZGg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b=DYEJr3xh; arc=none smtp.client-ip=209.85.221.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="DYEJr3xh" Received: by mail-wr1-f45.google.com with SMTP id ffacd0b85a97d-44b052142e1so1264182f8f.1 for ; Fri, 08 May 2026 08:03:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1778252623; x=1778857423; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=f2MMTl7quIO4DRgo4Wy71sfQT6nifE8diEZsX0WUHk8=; b=DYEJr3xhtUsumG8YhZCKjV6Jq5o8wwqsXuXoaje4cx26f4s/UiREaDcsrRoaH7Fyls k1f5XPbAJwblGtGUHNX/wjqr2i/ywHe5uBSd9RYPHwewp/IdJJ8tXGidrnKYiYrk4hRp kSEWlmxtRymftfpMoyWFQ3F4bvKowMZF4DXsgNx2veA2sKUjm4fLsPMBjruw+5JVwdQx QWmjgY3e1EBf2lmLetk26PqBZWvyabozCVxqlYnjqIm/Hq6FOUqzov4zgzm6SsI8IuPF SuQHeFHaWa4s/tfHIQ+cDEQfEEgUdgY6EcXqg5TYEyraQ3VOdWdr8Hc890PIfJcnu518 teJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778252623; x=1778857423; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=f2MMTl7quIO4DRgo4Wy71sfQT6nifE8diEZsX0WUHk8=; b=TwNKmFSot0oI1xd/4+fowtp64tUayfqHTHvD4UbWQv1CfoNRfsVdoxH/9TIKpBvy61 lfSuhr/9lOKCYAddrl1LzMBnybJrOgJR4hsHs16AA/KEPHpfWDZ+mlDPLflrEPKD7K2N 6SA3funUyLnRc8A5/P8cC+v+ycly4fwt7swNd/ZAjKBkieT8GxRUvy+d5k+z5WphbSd9 M3h8kfwuMfWMCby4cbC0R37eBBAa32xXI4RGBasvbxSCHeRimnD3cZROPGcDBUP39Xeo Ne3cWy5/PEEK/g992q+lG7hTrONmHZwBEZowxGAcGW/v1AYHIS2ho20cae2aFU4foXLd X6PQ== X-Gm-Message-State: AOJu0Yz6nNqfdWjLMBd9xs3sTazi14lUiAcI5JbB0/2QY4PI9VokRyT0 Ur8hoFYKXueO2Rr2ui1hAh0CAecbRuH0uPQi56fF9FJrxxGuREdSpA1JjW7TpTslva9Pq/jrnOZ 9280RRiU= X-Gm-Gg: Acq92OH3zjAEv+0+qXfE95pYD7Z0aPln+Xmni7az0F/Wy/BWNaJ5z3Z2kJPxJJFDUro VHyBmIxqvcbNIvmXHEX899EeWWFUambE81Q2bUn5+q4QEUw+sLMeX1R8z+WVrJ9x5UWk1j+p9Xo XF+ncb2CpiOIuP9Q+zm1bjdgKHpPKmaToWxM0Rk2N1GZtRSUUvzvN2CQhr0VM5ayCtKxXYayffV /cZW1xAinB1sAke7GLugpU+9xGst8OxaJfJ6IMI49aKF8M9etKyhqwh0kwoYi5khHsTqhiLtJ1/ 3U+7PFFcPeAI7x4QS6paaNpDZikBC0q1cr7cEBwAfVMe0mDkWICkIZI1mwZxoQSGg8n3yCpYKzm VySQfh4C4doYfCaAAuQEc1IoaI8vhyzDGRM5ktJ4XB/oDdbctz/d2IGGQFHIjyRzZ6dgGAmCxq7 I+NqJCy8rjNhN2uLXQI1hGjBP+ukAGlg78pU/zU6FaNalyezlRhXoSlc70uQ== X-Received: by 2002:a5d:5d02:0:b0:43e:aa88:f1a1 with SMTP id ffacd0b85a97d-4515d4d1107mr20288394f8f.30.1778252622785; Fri, 08 May 2026 08:03:42 -0700 (PDT) Received: from localhost.localdomain ([2a00:6d43:105:c401:e307:1a37:2e76:ce91]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-45491ca2fd6sm5262918f8f.30.2026.05.08.08.03.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 May 2026 08:03:42 -0700 (PDT) From: Marco Crivellari To: linux-kernel@vger.kernel.org, linux-sound@vger.kernel.org Cc: Tejun Heo , Lai Jiangshan , Frederic Weisbecker , Sebastian Andrzej Siewior , Marco Crivellari , Michal Hocko , Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Oder Chiou Subject: [RFC PATCH 2/2] ASoC: codecs: rt5640: Move long delayed work on system_dfl_long_wq Date: Fri, 8 May 2026 17:03:19 +0200 Message-ID: <20260508150327.351779-3-marco.crivellari@suse.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260508150327.351779-1-marco.crivellari@suse.com> References: <20260508150327.351779-1-marco.crivellari@suse.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="utf-8" Content-Transfer-Encoding: quoted-printable Currently the code enqueue work items using {queue|mod}_delayed_work(), using system_long_wq. This workqueue should be used when long works are expected and it is a per-cpu workqueue. The function(s) end up calling __queue_delayed_work(), which set a global timer that could fire anywhere, enqueuing the work where the timer fired. Unbound works could benefit from scheduler task placement, to optimize performance and power consumption. Long work shouldn't stick to a single CPU. Recently, a new unbound workqueue specific for long running work has been added: =C2=A0=C2=A0=C2=A0=C2=A0c116737e972e ("workqueue: Add system_dfl_long_wq fo= r long unbound works") Since the workqueue work doesn't rely on per-cpu variables, there is no obvious reason that justify the use of a per-cpu workqueue. So change system_long_wq with system_dfl_long_wq so that the work may benefit from scheduler task placement. Cc: Oder Chiou Signed-off-by: Marco Crivellari --- sound/soc/codecs/rt5640.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/sound/soc/codecs/rt5640.c b/sound/soc/codecs/rt5640.c index f6c6294e1588..1a5bb72b7d03 100644 --- a/sound/soc/codecs/rt5640.c +++ b/sound/soc/codecs/rt5640.c @@ -2397,7 +2397,7 @@ static void rt5640_jack_work(struct work_struct *work) * disabled the OVCD IRQ, the IRQ pin will stay high and as * we react to edges, we miss the unplug event -> recheck. */ - queue_delayed_work(system_long_wq, &rt5640->jack_work, 0); + queue_delayed_work(system_dfl_long_wq, &rt5640->jack_work, 0); } } =20 @@ -2410,7 +2410,8 @@ static irqreturn_t rt5640_irq(int irq, void *data) delay =3D 100; =20 if (rt5640->jack) - mod_delayed_work(system_long_wq, &rt5640->jack_work, delay); + mod_delayed_work(system_dfl_long_wq, &rt5640->jack_work, + delay); =20 return IRQ_HANDLED; } @@ -2419,7 +2420,7 @@ static irqreturn_t rt5640_jd_gpio_irq(int irq, void *= data) { struct rt5640_priv *rt5640 =3D data; =20 - queue_delayed_work(system_long_wq, &rt5640->jack_work, + queue_delayed_work(system_dfl_long_wq, &rt5640->jack_work, msecs_to_jiffies(JACK_SETTLE_TIME)); =20 return IRQ_HANDLED; @@ -2579,7 +2580,7 @@ static void rt5640_enable_jack_detect(struct snd_soc_= component *component, rt5640->irq_requested =3D true; =20 /* sync initial jack state */ - queue_delayed_work(system_long_wq, &rt5640->jack_work, 0); + queue_delayed_work(system_dfl_long_wq, &rt5640->jack_work, 0); } =20 static const struct snd_soc_dapm_route rt5640_hda_jack_dapm_routes[] =3D { @@ -2632,7 +2633,7 @@ static void rt5640_enable_hda_jack_detect( rt5640->irq_requested =3D true; =20 /* sync initial jack state */ - queue_delayed_work(system_long_wq, &rt5640->jack_work, 0); + queue_delayed_work(system_dfl_long_wq, &rt5640->jack_work, 0); =20 snd_soc_dapm_add_routes(dapm, rt5640_hda_jack_dapm_routes, ARRAY_SIZE(rt5640_hda_jack_dapm_routes)); @@ -2860,7 +2861,7 @@ static int rt5640_resume(struct snd_soc_component *co= mponent) } =20 enable_irq(rt5640->irq); - queue_delayed_work(system_long_wq, &rt5640->jack_work, 0); + queue_delayed_work(system_dfl_long_wq, &rt5640->jack_work, 0); } =20 return 0; --=20 2.53.0