From patchwork Wed Oct 22 13:57:45 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 39299 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f69.google.com (mail-la0-f69.google.com [209.85.215.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id BC64E202DB for ; Wed, 22 Oct 2014 13:58:03 +0000 (UTC) Received: by mail-la0-f69.google.com with SMTP id q1sf2088175lam.4 for ; Wed, 22 Oct 2014 06:58:02 -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=OsNgt/m3a3kaYR9a6kCOSPH32XMK/4vPSqkQCgJlBvI=; b=lJBDUj0QuJGaswLNN9g0OjEr/tY+Qu00lZndHl481N3ykQAJ6L6z7KbD7KZFFci0W7 C9B0COGIyuUOsv47NLp2+4NscOfrU8P7h4KjnXbgo+O7te4bM2GxiTQWMEvP/FIjKNUH cY4U2X7ET18CK4kP+ICAXK97zuRk4bzCrGCLJAiFLcGrVA6L0APwqe8yA5RBvkS3+gkE 1wnLmgDAy8QaricXo9u1TxkdO+sAQkL8yOWoCF6MTTBZODqewoEeCuQ6LagUV+iCCVYV xuLLMgfbZ5MKJ8Jf+PW1wdWIwP7dKcOoDgDZnu5hZP6PAYSDVgpoBaSL4DDy0xi2xvex UV1A== X-Gm-Message-State: ALoCoQkVvv7/15tGoLYS0banYCUGpr4KDKhETyT/j8iylfiSHfjl74PUmY9wIaMVM9uaTt1bS1HK X-Received: by 10.180.182.164 with SMTP id ef4mr1083994wic.0.1413986282285; Wed, 22 Oct 2014 06:58:02 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.7.37 with SMTP id g5ls214080laa.91.gmail; Wed, 22 Oct 2014 06:58:02 -0700 (PDT) X-Received: by 10.152.228.140 with SMTP id si12mr41813280lac.66.1413986282092; Wed, 22 Oct 2014 06:58:02 -0700 (PDT) Received: from mail-lb0-f176.google.com (mail-lb0-f176.google.com. [209.85.217.176]) by mx.google.com with ESMTPS id l5si16160502lag.57.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 patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.176 as permitted sender) client-ip=209.85.217.176; Received: by mail-lb0-f176.google.com with SMTP id p9so2819179lbv.7 for ; Wed, 22 Oct 2014 06:58:02 -0700 (PDT) X-Received: by 10.152.29.8 with SMTP id f8mr41938552lah.56.1413986282003; Wed, 22 Oct 2014 06:58:02 -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 c5csp76276lbz; Wed, 22 Oct 2014 06:58:01 -0700 (PDT) X-Received: by 10.194.2.129 with SMTP id 1mr52860496wju.12.1413986280860; Wed, 22 Oct 2014 06:58:00 -0700 (PDT) Received: from mail-wi0-f181.google.com (mail-wi0-f181.google.com. [209.85.212.181]) by mx.google.com with ESMTPS id ar3si18431294wjc.149.2014.10.22.06.58.00 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 22 Oct 2014 06:58:00 -0700 (PDT) Received-SPF: pass (google.com: domain of daniel.lezcano@linaro.org designates 209.85.212.181 as permitted sender) client-ip=209.85.212.181; Received: by mail-wi0-f181.google.com with SMTP id n3so974397wiv.2 for ; Wed, 22 Oct 2014 06:58:00 -0700 (PDT) X-Received: by 10.180.207.72 with SMTP id lu8mr37065858wic.2.1413986280606; Wed, 22 Oct 2014 06:58:00 -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.57.58 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 22 Oct 2014 06:58:00 -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 02/10] cpuidle: Checking the zero latency inside the governors does not make sense. Date: Wed, 22 Oct 2014 15:57:45 +0200 Message-Id: <1413986273-28522-3-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.217.176 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: , If the zero latency is required, we don't want to invoke any cpuidle code at all. Move the check within the governors and do the check before selecting the state in order to fallback to the default idle function. Signed-off-by: Daniel Lezcano --- drivers/cpuidle/governors/ladder.c | 6 ------ drivers/cpuidle/governors/menu.c | 4 ---- kernel/sched/idle.c | 8 ++++++++ 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/drivers/cpuidle/governors/ladder.c b/drivers/cpuidle/governors/ladder.c index 044ee0d..a7f18e7 100644 --- a/drivers/cpuidle/governors/ladder.c +++ b/drivers/cpuidle/governors/ladder.c @@ -71,12 +71,6 @@ static int ladder_select_state(struct cpuidle_driver *drv, int last_residency, last_idx = ldev->last_state_idx; int latency_req = pm_qos_request(PM_QOS_CPU_DMA_LATENCY); - /* Special case when user has set very strict latency requirement */ - if (unlikely(latency_req == 0)) { - ladder_do_selection(ldev, last_idx, 0); - return 0; - } - last_state = &ldev->states[last_idx]; if (drv->states[last_idx].flags & CPUIDLE_FLAG_TIME_VALID) { diff --git a/drivers/cpuidle/governors/menu.c b/drivers/cpuidle/governors/menu.c index 34db2fb..4ed3915 100644 --- a/drivers/cpuidle/governors/menu.c +++ b/drivers/cpuidle/governors/menu.c @@ -302,10 +302,6 @@ static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev) data->last_state_idx = CPUIDLE_DRIVER_STATE_START - 1; - /* Special case when user has set very strict latency requirement */ - if (unlikely(latency_req == 0)) - return 0; - /* determine the expected residency time, round up */ data->next_timer_us = ktime_to_us(tick_nohz_get_sleep_length()); diff --git a/kernel/sched/idle.c b/kernel/sched/idle.c index 11e7bc4..3042b924 100644 --- a/kernel/sched/idle.c +++ b/kernel/sched/idle.c @@ -78,6 +78,7 @@ static void cpuidle_idle_call(void) { struct cpuidle_device *dev = __this_cpu_read(cpuidle_devices); struct cpuidle_driver *drv = cpuidle_get_cpu_driver(dev); + int latency_req = pm_qos_request(PM_QOS_CPU_DMA_LATENCY); int next_state, entered_state; unsigned int broadcast; @@ -104,6 +105,13 @@ static void cpuidle_idle_call(void) rcu_idle_enter(); /* + * The latency requirement does not allow any latency, jump to + * the default idle function + */ + if (latency_req == 0) + goto use_default; + + /* * Ask the cpuidle framework to choose a convenient idle state. * Fall back to the default arch idle method on errors. */