From patchwork Tue Nov 15 08:23:23 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 82275 Delivered-To: patch@linaro.org Received: by 10.140.97.165 with SMTP id m34csp1410738qge; Tue, 15 Nov 2016 00:24:19 -0800 (PST) X-Received: by 10.98.158.155 with SMTP id f27mr44520504pfk.165.1479198259282; Tue, 15 Nov 2016 00:24:19 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z7si25547278pgz.226.2016.11.15.00.24.19; Tue, 15 Nov 2016 00:24:19 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966115AbcKOIYA (ORCPT + 26 others); Tue, 15 Nov 2016 03:24:00 -0500 Received: from mail-pf0-f173.google.com ([209.85.192.173]:33776 "EHLO mail-pf0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965961AbcKOIXw (ORCPT ); Tue, 15 Nov 2016 03:23:52 -0500 Received: by mail-pf0-f173.google.com with SMTP id d2so35114129pfd.0 for ; Tue, 15 Nov 2016 00:23:52 -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:in-reply-to:references :in-reply-to:references; bh=rfV/H/2yg0QPUErLQmZYrH9G2EJr0dMrCn4EutT3a98=; b=fgX8y3k8NmjC5I+FBpzqoYYHwfcYApO8gRZ8DGv8BKdkQy6sosIWpi1qFb72VQ9bRO E39WhEkDWt/XRJl9Xedw8Fpn6SzvfKDv4rFFd4BZy0Vix2KXKhKtfRkrcytQsCYBOf1m NcG7x96qVMBySFLVy6UKEghjbgQXEVJqirK+k= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=rfV/H/2yg0QPUErLQmZYrH9G2EJr0dMrCn4EutT3a98=; b=DO5zZ0rpz0o6kZVTMydkdQkPzM+EP0O12PEn4Je7zdF9STqy8BMJVayV4urOsLSzxi zmbwGRl6FHfr6DHVWTxJheNeY4cBWbOvvuDKfCOWutlLkcU7ennVBzBNfEGBTmUbWT6p PbcEnS6RGxbGiGYe7Zt+yrwsPdNFY5JGnjd1EUp1F2FXsDnDoXvcAnfbcFR4P7Bq1/lF +JSxyl8ub+kBEb8mTOUr6zqtW8wdTl7WHIW6P6nBJPVX9ffXsdYq0eG65oMA7cCWbfza jaGUtmRWT98ql8JERv8AwdcD52Tw40b9jXpZ2ucuD5/QOcpfoX/oDXj9CuCP0nER9EgP cXPw== X-Gm-Message-State: ABUngvcahTSSCyoSWqp2lBH5F8lQSTDb0jkyPPZRPoQmJsCFYL5JXq7PUeqRD+IQ7nGgXnoh X-Received: by 10.98.67.138 with SMTP id l10mr45564666pfi.101.1479198231977; Tue, 15 Nov 2016 00:23:51 -0800 (PST) Received: from localhost ([122.172.89.192]) by smtp.gmail.com with ESMTPSA id wg1sm40728576pab.46.2016.11.15.00.23.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 15 Nov 2016 00:23:50 -0800 (PST) From: Viresh Kumar To: Rafael Wysocki , Ingo Molnar , Peter Zijlstra Cc: linaro-kernel@lists.linaro.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Vincent Guittot , Juri Lelli , Robin Randhawa , Steve Muckle , Viresh Kumar Subject: [PATCH V2 4/4] cpufreq: schedutil: irq-work and mutex are only used in slow path Date: Tue, 15 Nov 2016 13:53:23 +0530 Message-Id: X-Mailer: git-send-email 2.7.1.410.g6faf27b In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Execute the irq-work specific initialization/exit code only when the fast path isn't available. Signed-off-by: Viresh Kumar --- kernel/sched/cpufreq_schedutil.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) -- 2.7.1.410.g6faf27b diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c index f165ba0f0766..42a220e78f00 100644 --- a/kernel/sched/cpufreq_schedutil.c +++ b/kernel/sched/cpufreq_schedutil.c @@ -390,15 +390,12 @@ static struct sugov_policy *sugov_policy_alloc(struct cpufreq_policy *policy) return NULL; sg_policy->policy = policy; - init_irq_work(&sg_policy->irq_work, sugov_irq_work); - mutex_init(&sg_policy->work_lock); raw_spin_lock_init(&sg_policy->update_lock); return sg_policy; } static void sugov_policy_free(struct sugov_policy *sg_policy) { - mutex_destroy(&sg_policy->work_lock); kfree(sg_policy); } @@ -432,6 +429,9 @@ static int sugov_kthread_create(struct sugov_policy *sg_policy) sg_policy->thread = thread; kthread_bind_mask(thread, policy->related_cpus); + init_irq_work(&sg_policy->irq_work, sugov_irq_work); + mutex_init(&sg_policy->work_lock); + wake_up_process(thread); return 0; @@ -445,6 +445,7 @@ static void sugov_kthread_stop(struct sugov_policy *sg_policy) kthread_flush_worker(&sg_policy->worker); kthread_stop(sg_policy->thread); + mutex_destroy(&sg_policy->work_lock); } static struct sugov_tunables *sugov_tunables_alloc(struct sugov_policy *sg_policy) @@ -611,8 +612,10 @@ static void sugov_stop(struct cpufreq_policy *policy) synchronize_sched(); - irq_work_sync(&sg_policy->irq_work); - kthread_cancel_work_sync(&sg_policy->work); + if (!policy->fast_switch_enabled) { + irq_work_sync(&sg_policy->irq_work); + kthread_cancel_work_sync(&sg_policy->work); + } } static void sugov_limits(struct cpufreq_policy *policy)