From mboxrd@z Thu Jan 1 00:00:00 1970 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: 8bit 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:     c116737e972e ("workqueue: Add system_dfl_long_wq for 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); } } @@ -2410,7 +2410,8 @@ static irqreturn_t rt5640_irq(int irq, void *data) delay = 100; if (rt5640->jack) - mod_delayed_work(system_long_wq, &rt5640->jack_work, delay); + mod_delayed_work(system_dfl_long_wq, &rt5640->jack_work, + delay); return IRQ_HANDLED; } @@ -2419,7 +2420,7 @@ static irqreturn_t rt5640_jd_gpio_irq(int irq, void *data) { struct rt5640_priv *rt5640 = data; - 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)); return IRQ_HANDLED; @@ -2579,7 +2580,7 @@ static void rt5640_enable_jack_detect(struct snd_soc_component *component, rt5640->irq_requested = true; /* 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); } static const struct snd_soc_dapm_route rt5640_hda_jack_dapm_routes[] = { @@ -2632,7 +2633,7 @@ static void rt5640_enable_hda_jack_detect( rt5640->irq_requested = true; /* 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); 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 *component) } 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); } return 0; -- 2.53.0