From patchwork Wed Oct 17 01:04:38 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Youquan Song X-Patchwork-Id: 1600681 Return-Path: X-Original-To: patchwork-linux-acpi@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 3DCB2E019F for ; Tue, 16 Oct 2012 13:01:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754595Ab2JPNBj (ORCPT ); Tue, 16 Oct 2012 09:01:39 -0400 Received: from mga01.intel.com ([192.55.52.88]:24835 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754527Ab2JPNBg (ORCPT ); Tue, 16 Oct 2012 09:01:36 -0400 Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP; 16 Oct 2012 06:01:36 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.80,593,1344236400"; d="scan'208";a="235733917" Received: from linux-youquan.bj.intel.com (HELO localhost.localdomain) ([10.238.155.110]) by fmsmga002.fm.intel.com with ESMTP; 16 Oct 2012 06:01:30 -0700 From: Youquan Song To: linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, arjan@linux.intel.com, lenb@kernel.org Cc: Rik van Riel , Youquan Song , Youquan Song Subject: [PATCH 3/5] x86,idle: Reset correction factor Date: Tue, 16 Oct 2012 21:04:38 -0400 Message-Id: <1350435880-19143-4-git-send-email-youquan.song@intel.com> X-Mailer: git-send-email 1.6.4.2 In-Reply-To: <1350435880-19143-3-git-send-email-youquan.song@intel.com> References: <1350435880-19143-1-git-send-email-youquan.song@intel.com> <1350435880-19143-2-git-send-email-youquan.song@intel.com> <1350435880-19143-3-git-send-email-youquan.song@intel.com> Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org In general case, the expected residency is much larger than deepest C-state target residency, but prediction logic still predicts the small predicted residency, so the prediction history is totally broken. In this situation, reset the correction factor is the only choice. Signed-off-by: Youquan Song Signed-off-by: Rik van Riel --- drivers/cpuidle/governors/menu.c | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/drivers/cpuidle/governors/menu.c b/drivers/cpuidle/governors/menu.c index b34bf11..7dbac97 100644 --- a/drivers/cpuidle/governors/menu.c +++ b/drivers/cpuidle/governors/menu.c @@ -221,6 +221,10 @@ EXPORT_SYMBOL_GPL(menu_hrtimer_cancel); static enum hrtimer_restart menu_hrtimer_notify(struct hrtimer *hrtimer) { int cpu = smp_processor_id(); + struct menu_device *data = &per_cpu(menu_devices, cpu); + + if (per_cpu(hrtimer_started, cpu) == 2) + data->correction_factor[data->bucket] = RESOLUTION * DECAY; per_cpu(hrtimer_started, cpu) = 0; @@ -386,7 +390,7 @@ static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev) hrtimer_start(hrtmr, ns_to_ktime(1000 * timer_us), HRTIMER_MODE_REL_PINNED); /* menu hrtimer is started */ - per_cpu(hrtimer_started, cpu) = 1; + per_cpu(hrtimer_started, cpu) = 2; } }