From patchwork Fri Nov 11 10:22: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: 81810 Delivered-To: patch@linaro.org Received: by 10.182.1.168 with SMTP id 8csp1382993obn; Fri, 11 Nov 2016 02:22:58 -0800 (PST) X-Received: by 10.36.47.9 with SMTP id j9mr7545500itj.108.1478859778870; Fri, 11 Nov 2016 02:22:58 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id fc7si2712159pab.324.2016.11.11.02.22.58; Fri, 11 Nov 2016 02:22:58 -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=neutral (body hash did not verify) header.i=@linaro.org; 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=fail (p=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932404AbcKKKWv (ORCPT + 13 others); Fri, 11 Nov 2016 05:22:51 -0500 Received: from mail-pf0-f176.google.com ([209.85.192.176]:33569 "EHLO mail-pf0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755708AbcKKKWn (ORCPT ); Fri, 11 Nov 2016 05:22:43 -0500 Received: by mail-pf0-f176.google.com with SMTP id d2so10121055pfd.0 for ; Fri, 11 Nov 2016 02:22:42 -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=n97RRtImWnsqWBGXRghew6uIKUs53aESveZY3WYMMqI=; b=MmdI+nLIDWxaPch0w0OH4yWCNBhfEM6Ibwa6ZukbMnKIOBAIK+omj1EfG58gsWjsbz TvmBoYAbJLNLPLl+/E3XyU8Ci8VJ4NGItA5Xp/2K3HoRz5Jc56bw5LyQqxQuxD0KHFxz 7M7kNi7Fd9mfSr1zeQgJEeMDJIZZxaEC151oQ= 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=n97RRtImWnsqWBGXRghew6uIKUs53aESveZY3WYMMqI=; b=Tg67hk+6qH6DY4+xoK2hZ8IA9tp2aJ/onP4BV9DCtfdT6Yh7+ealPSl1B9GkQGfCHc sHptmEcxuohgofgVqaxb+8yMLCRPU35+LvMBwV2CXc8lUJm/2X/9pWNaZGkJS0qmt/Ui qul+IWcJG3iPC8qeEcRSGdcoX/x7Hl+SA/QGSyT8qxETnSlnJnF11Nb85Effq6fnHPrH N/j+1m/Bzg4Zl55a5m6IsyvXKhwdNmMjAzeKA0I9BbQt75FTZ7TGNCUuJanq3h/eQN6z x77cywBKT6aDel0/Az0tnWBboqr4jws4RlhtF8yjW2ZxdXQ1xb6yecxt1sJjpZCUnKfZ 1jRQ== X-Gm-Message-State: ABUngvftN9L06M60jbB1C+QcNwPLqAcIYXUE/fc6GhPiRe8yhySQwoEKcvkl3073BL/83Y4I X-Received: by 10.99.232.17 with SMTP id s17mr43683047pgh.127.1478859762488; Fri, 11 Nov 2016 02:22:42 -0800 (PST) Received: from localhost ([122.172.89.192]) by smtp.gmail.com with ESMTPSA id p68sm13927245pfd.11.2016.11.11.02.22.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 11 Nov 2016 02:22:42 -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 , Viresh Kumar Subject: [PATCH 3/3] cpufreq: schedutil: irq-work is used only in slow path Date: Fri, 11 Nov 2016 15:52:23 +0530 Message-Id: <8435d76015786b26b343a5588e2758b4caf6760e.1478858983.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.7.1.410.g6faf27b In-Reply-To: References: In-Reply-To: References: Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Execute the irq-work specific initialization/exit code only when fast path isn't available. Signed-off-by: Viresh Kumar --- kernel/sched/cpufreq_schedutil.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) -- 2.7.1.410.g6faf27b -- To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c index 045ce0a4e6d1..219e717bcd15 100644 --- a/kernel/sched/cpufreq_schedutil.c +++ b/kernel/sched/cpufreq_schedutil.c @@ -371,9 +371,9 @@ static void sugov_policy_free(struct sugov_policy *sg_policy) if (!sg_policy->policy->fast_switch_enabled) { kthread_flush_worker(&sg_policy->worker); kthread_stop(sg_policy->thread); + mutex_destroy(&sg_policy->work_lock); } - mutex_destroy(&sg_policy->work_lock); kfree(sg_policy); } @@ -389,8 +389,6 @@ 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); /* kthread only required for slow path */ @@ -402,7 +400,6 @@ static struct sugov_policy *sugov_policy_alloc(struct cpufreq_policy *policy) thread = kthread_create(kthread_worker_fn, &sg_policy->worker, "sugov:%d", cpumask_first(policy->related_cpus)); if (IS_ERR(thread)) { - mutex_destroy(&sg_policy->work_lock); kfree(sg_policy); pr_err("failed to create sugov thread: %ld\n", PTR_ERR(thread)); return NULL; @@ -416,6 +413,9 @@ static struct sugov_policy *sugov_policy_alloc(struct cpufreq_policy *policy) return NULL; } + init_irq_work(&sg_policy->irq_work, sugov_irq_work); + mutex_init(&sg_policy->work_lock); + kthread_bind_mask(thread, policy->related_cpus); wake_up_process(thread); @@ -578,8 +578,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)