From patchwork Wed Jan 3 09:24:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 123285 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp9949686qgn; Wed, 3 Jan 2018 01:24:42 -0800 (PST) X-Google-Smtp-Source: ACJfBos5rC9b1kc1iip49cIT2ZXFYdCa8/N6jgEQDWu6VgMRfQyhZ2XshwH1a6djTrudBNBw4tDY X-Received: by 10.101.90.8 with SMTP id y8mr752271pgs.42.1514971482450; Wed, 03 Jan 2018 01:24:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1514971482; cv=none; d=google.com; s=arc-20160816; b=nwxxHSowUhMIExpUVE+B4aZYQ9q9TnP9VBaHU/vT5P92fw3MFrOP79NWWmW+xypUVF YJeYfHSNgzSY6GvJ2T6Wuw3oXWdDY+9YgeINNAinsotdtx7vks6o/FYqnBNUx4HAssbX HgOy1oHHecbDVSj6+oLgwyjlxlI5iXeMrzFJaixL/n9M6Hs6c0KTLMlL2QgzVW4Uqo2/ TTaQTiE9i7xklNZxGZfTFrUtC2uTwp87B94RtoHiSuSKgEMT5MHe1yHNcA1/O9RDsVNc wGnrN1ZTctpzavlWIQCZOk5rln//vJ6WXwiY+Wlqp7tLm8glsFbGJU3Gh6ezQtiLfOCd lGyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=U/zUE6y/EgGuHXtHECI1/u3aPBLNV+y9FYxUb/1jSms=; b=VWZ0iEbRQXMvGEOGILf72HN67FNl3Fu3LhAnrLhywEHI9MUtVfjQ9+0fXjT96UPI72 VFc9iZ/93JXy/Rxwi976HwYnsDE9sFTnMICx3IAReJMiRrwM+drDV9aNM/BYCdt6EOay Idfn71GemeUVRYnkbBEry9bDNpn7S1xeGKBrgJ8UMAGGKVTlQSOShSBnBQGyOTAEuQ4n sC3+VATWgYGHw/easzfubi+Xmqjc1IaYPJHfFtdadm7vBW032s6N7WbRfzCqW/oD4zwz 7dPol1maGUb1/X3CwtTLHsCiGk4W3lGnPmXnolwVLY9bO3RRm2RVZLYuuyzaJSvBBsjB 6b7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FaGtL/Ti; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h12si447925pls.547.2018.01.03.01.24.41; Wed, 03 Jan 2018 01:24:42 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FaGtL/Ti; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751821AbeACJYk (ORCPT + 11 others); Wed, 3 Jan 2018 04:24:40 -0500 Received: from mail-oi0-f67.google.com ([209.85.218.67]:34915 "EHLO mail-oi0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751712AbeACJYi (ORCPT ); Wed, 3 Jan 2018 04:24:38 -0500 Received: by mail-oi0-f67.google.com with SMTP id 184so603793oii.2 for ; Wed, 03 Jan 2018 01:24:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=U/zUE6y/EgGuHXtHECI1/u3aPBLNV+y9FYxUb/1jSms=; b=FaGtL/TiVIpZy/hDFWhW3zGZAUwJqajLByjUjYh1//j4cegMdZXltDs8GBlwRwNcwS 8mZu2ibv2pVotzrLwuuyZRF5RnkQdWM2ABKjvpaSViEo8xA4zTOYBLVJZGEUc03tqcl9 YOUUl6SqX83k4xLlzi1JL7PeX0UErGqtBZWXA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=U/zUE6y/EgGuHXtHECI1/u3aPBLNV+y9FYxUb/1jSms=; b=DdNotPE8I0/ZtzsCFm3v39ZPN6i564PxbPJU4gWr4eImYRCtmFlJvCkSdN4xmRoybr REkKPu7ffQDn36/RtZ/yR4uN85Xk07yvcQHu6fJ51ZLVksVfSio6SGL3janD/9yIXNUu ncg22vvsI0gGrgaYWuXP+AAOlw5a7VnR23dHEqPLbSKLDPJZVIVAUT5/sxv3RhvKlgl4 0P5W0eLEksC3hacMxaMcpNTZg2U2tGNzyauRpYu5zAMVKyuWEk5JDSwYPTyi96Cwb+ZL 0mHvBgzsWZZ9Yi8nMAeKsrCrcYsMfIUMNw/d/FmBZzZkwTMeBG0lxHRC/e14xOHRmxOX jAoA== X-Gm-Message-State: AKGB3mLFbiH3wT6GLV57JTXH4290/yQw7F2zMsNPHl293rzzMsFK/FVq 5WsYlKM5OOt/4hFtKxkjhbP9Bw== X-Received: by 10.202.235.135 with SMTP id j129mr366525oih.102.1514971478301; Wed, 03 Jan 2018 01:24:38 -0800 (PST) Received: from localhost.localdomain (li319-30.members.linode.com. [66.228.62.30]) by smtp.gmail.com with ESMTPSA id z8sm264775ota.57.2018.01.03.01.24.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 03 Jan 2018 01:24:36 -0800 (PST) From: Leo Yan To: Zhang Rui , Eduardo Valentin , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Leo Yan , Daniel Lezcano , Vincent Guittot Subject: [PATCH] thermal: Use power efficient workqueue Date: Wed, 3 Jan 2018 17:24:16 +0800 Message-Id: <1514971456-2877-1-git-send-email-leo.yan@linaro.org> X-Mailer: git-send-email 2.7.4 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Thermal core framework uses the system_freezable_wq workqueue as its workqueue for polling temperature. Using system_freezable_wq workqueue prevents the scheduler to make smart decision about the best place to schedule the work. This commit replaces system_freezable_wq with system_freezable_power_efficient_wq. With kernel configuration CONFIG_WQ_POWER_EFFICIENT is enabled, the work can be scheduled on the best CPU from a power or a performance point of view. This commit is inspired by Vincent Guittot patch "netfilter: conntrack: use power efficient workqueue" and verified on 96boards Hikey960. Cc: Eduardo Valentin Cc: Zhang Rui Cc: Daniel Lezcano Cc: Vincent Guittot Signed-off-by: Leo Yan --- drivers/thermal/thermal_core.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) -- 2.7.4 Acked-by: Vincent Guittot diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index 2b1b0ba..ba90f71 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -293,11 +293,12 @@ static void thermal_zone_device_set_polling(struct thermal_zone_device *tz, int delay) { if (delay > 1000) - mod_delayed_work(system_freezable_wq, &tz->poll_queue, + mod_delayed_work(system_freezable_power_efficient_wq, + &tz->poll_queue, round_jiffies(msecs_to_jiffies(delay))); else if (delay) - mod_delayed_work(system_freezable_wq, &tz->poll_queue, - msecs_to_jiffies(delay)); + mod_delayed_work(system_freezable_power_efficient_wq, + &tz->poll_queue, msecs_to_jiffies(delay)); else cancel_delayed_work(&tz->poll_queue); }