From patchwork Wed Oct 22 13:57:46 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 39300 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ee0-f69.google.com (mail-ee0-f69.google.com [74.125.83.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 06F69202DB for ; Wed, 22 Oct 2014 13:58:04 +0000 (UTC) Received: by mail-ee0-f69.google.com with SMTP id b57sf1688348eek.0 for ; Wed, 22 Oct 2014 06:58:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=n+qHvw2MvzuzeGccq8YUtE158/DtcNG7SoiV3/yW4hw=; b=KYdDDsXIj7H5o4UAirDXUNbjSwBiZvFfJh8O922Q14aj7VCx+pMlxlLx+UfXTsEXoW A4OextQxV+gFOeOsKaCJ4ONCiSnTyyZhwGZsrWqGPvbUzV8F2YF9y2FxkB5laWagLH0h fbcSLli0q+PHROD2tqmt3pAHGqX/4XXRWBn1TVMVSeSihnMbZY1SSumai+HRUIHzkNHX w9AH5/VTBorl66UDL6rtU/lVd8U04n9uVW2OQrDTWH+U+tQdKk31djr6QQRx3J4cEy0w /C3L5YZoz4ucyqWbYG6BEd5DDBcAGv22AIAbYxM8LDm75EPh6C/SGAXRrzvHj6AUChKe YAeg== X-Gm-Message-State: ALoCoQmyw16t0qnx3vw/7ueL7gBx/+7YS8bWXDOHIzzsxptY+XLKR/SZWKqifX+7KCa/Y1G0i1/1 X-Received: by 10.180.74.130 with SMTP id t2mr1080037wiv.4.1413986284096; Wed, 22 Oct 2014 06:58:04 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.27.201 with SMTP id v9ls195639lag.25.gmail; Wed, 22 Oct 2014 06:58:03 -0700 (PDT) X-Received: by 10.112.132.34 with SMTP id or2mr10153433lbb.75.1413986283930; Wed, 22 Oct 2014 06:58:03 -0700 (PDT) Received: from mail-la0-f47.google.com (mail-la0-f47.google.com. [209.85.215.47]) by mx.google.com with ESMTPS id j9si23487139lab.13.2014.10.22.06.58.03 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 22 Oct 2014 06:58:03 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.47 as permitted sender) client-ip=209.85.215.47; Received: by mail-la0-f47.google.com with SMTP id pv20so2941554lab.6 for ; Wed, 22 Oct 2014 06:58:03 -0700 (PDT) X-Received: by 10.152.6.228 with SMTP id e4mr41871402laa.71.1413986283599; Wed, 22 Oct 2014 06:58:03 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.112.84.229 with SMTP id c5csp76281lbz; Wed, 22 Oct 2014 06:58:03 -0700 (PDT) X-Received: by 10.180.90.237 with SMTP id bz13mr38369973wib.50.1413986282790; Wed, 22 Oct 2014 06:58:02 -0700 (PDT) Received: from mail-wg0-f52.google.com (mail-wg0-f52.google.com. [74.125.82.52]) by mx.google.com with ESMTPS id qj3si18488066wjc.78.2014.10.22.06.58.02 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 22 Oct 2014 06:58:02 -0700 (PDT) Received-SPF: pass (google.com: domain of daniel.lezcano@linaro.org designates 74.125.82.52 as permitted sender) client-ip=74.125.82.52; Received: by mail-wg0-f52.google.com with SMTP id a1so3731673wgh.23 for ; Wed, 22 Oct 2014 06:58:02 -0700 (PDT) X-Received: by 10.180.74.173 with SMTP id u13mr37834943wiv.64.1413986282568; Wed, 22 Oct 2014 06:58:02 -0700 (PDT) Received: from localhost.localdomain (AToulouse-656-1-959-39.w90-50.abo.wanadoo.fr. [90.50.216.39]) by mx.google.com with ESMTPSA id f7sm2030217wiz.13.2014.10.22.06.58.00 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 22 Oct 2014 06:58:01 -0700 (PDT) From: Daniel Lezcano To: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Cc: axboe@kernel.dk, rafael.j.wysocki@intel.com, mingo@kernel.org, peterz@infradead.org, preeti@linux.vnet.ibm.com, Morten.Rasmussen@arm.com, mturquette@linaro.org, tuukka.tikkanen@linaro.org, nicolas.pitre@linaro.org, patches@linaro.org Subject: [RFD PATCH 03/10] sched: idle: cpudidle: Pass the latency req from idle.c Date: Wed, 22 Oct 2014 15:57:46 +0200 Message-Id: <1413986273-28522-4-git-send-email-daniel.lezcano@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1413986273-28522-1-git-send-email-daniel.lezcano@linaro.org> References: <1413986273-28522-1-git-send-email-daniel.lezcano@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: daniel.lezcano@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.47 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , As we get the latency_req from cpuidle_idle_call, just pass it to the cpuidle layer instead of duplicating the code across the governors. That has the benefit of moving little by little the different timings we want to integrate with the scheduler near this one. Signed-off-by: Daniel Lezcano --- drivers/cpuidle/cpuidle.c | 5 +++-- drivers/cpuidle/governors/ladder.c | 3 +-- drivers/cpuidle/governors/menu.c | 4 ++-- include/linux/cpuidle.h | 7 ++++--- kernel/sched/idle.c | 3 ++- 5 files changed, 12 insertions(+), 10 deletions(-) diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c index ee9df5e..372c36f 100644 --- a/drivers/cpuidle/cpuidle.c +++ b/drivers/cpuidle/cpuidle.c @@ -158,7 +158,8 @@ int cpuidle_enter_state(struct cpuidle_device *dev, struct cpuidle_driver *drv, * * Returns the index of the idle state. */ -int cpuidle_select(struct cpuidle_driver *drv, struct cpuidle_device *dev) +int cpuidle_select(struct cpuidle_driver *drv, struct cpuidle_device *dev, + int latency_req) { if (off || !initialized) return -ENODEV; @@ -169,7 +170,7 @@ int cpuidle_select(struct cpuidle_driver *drv, struct cpuidle_device *dev) if (unlikely(use_deepest_state)) return cpuidle_find_deepest_state(drv, dev); - return cpuidle_curr_governor->select(drv, dev); + return cpuidle_curr_governor->select(drv, dev, latency_req); } /** diff --git a/drivers/cpuidle/governors/ladder.c b/drivers/cpuidle/governors/ladder.c index a7f18e7..18f0da9 100644 --- a/drivers/cpuidle/governors/ladder.c +++ b/drivers/cpuidle/governors/ladder.c @@ -64,12 +64,11 @@ static inline void ladder_do_selection(struct ladder_device *ldev, * @dev: the CPU */ static int ladder_select_state(struct cpuidle_driver *drv, - struct cpuidle_device *dev) + struct cpuidle_device *dev, int latency_req) { struct ladder_device *ldev = &__get_cpu_var(ladder_devices); struct ladder_device_state *last_state; int last_residency, last_idx = ldev->last_state_idx; - int latency_req = pm_qos_request(PM_QOS_CPU_DMA_LATENCY); last_state = &ldev->states[last_idx]; diff --git a/drivers/cpuidle/governors/menu.c b/drivers/cpuidle/governors/menu.c index 4ed3915..96f8fb0 100644 --- a/drivers/cpuidle/governors/menu.c +++ b/drivers/cpuidle/governors/menu.c @@ -287,10 +287,10 @@ again: * @drv: cpuidle driver containing state data * @dev: the CPU */ -static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev) +static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev, + int latency_req) { struct menu_device *data = &__get_cpu_var(menu_devices); - int latency_req = pm_qos_request(PM_QOS_CPU_DMA_LATENCY); int i; unsigned int interactivity_req; unsigned long nr_iowaiters, cpu_load; diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h index 25e0df6..fb465c1 100644 --- a/include/linux/cpuidle.h +++ b/include/linux/cpuidle.h @@ -122,7 +122,7 @@ struct cpuidle_driver { extern void disable_cpuidle(void); extern int cpuidle_select(struct cpuidle_driver *drv, - struct cpuidle_device *dev); + struct cpuidle_device *dev, int latency_req); extern int cpuidle_enter(struct cpuidle_driver *drv, struct cpuidle_device *dev, int index); extern void cpuidle_reflect(struct cpuidle_device *dev, int index); @@ -150,7 +150,7 @@ extern struct cpuidle_driver *cpuidle_get_cpu_driver(struct cpuidle_device *dev) #else static inline void disable_cpuidle(void) { } static inline int cpuidle_select(struct cpuidle_driver *drv, - struct cpuidle_device *dev) + struct cpuidle_device *dev, int latency_req) {return -ENODEV; } static inline int cpuidle_enter(struct cpuidle_driver *drv, struct cpuidle_device *dev, int index) @@ -205,7 +205,8 @@ struct cpuidle_governor { struct cpuidle_device *dev); int (*select) (struct cpuidle_driver *drv, - struct cpuidle_device *dev); + struct cpuidle_device *dev, + int latency_req); void (*reflect) (struct cpuidle_device *dev, int index); struct module *owner; diff --git a/kernel/sched/idle.c b/kernel/sched/idle.c index 3042b924..72955e9 100644 --- a/kernel/sched/idle.c +++ b/kernel/sched/idle.c @@ -5,6 +5,7 @@ #include #include #include +#include #include #include @@ -115,7 +116,7 @@ static void cpuidle_idle_call(void) * Ask the cpuidle framework to choose a convenient idle state. * Fall back to the default arch idle method on errors. */ - next_state = cpuidle_select(drv, dev); + next_state = cpuidle_select(drv, dev, latency_req); if (next_state < 0) { use_default: /*