From nobody@FreeBSD.org Sat Feb 7 20:09:14 2009 Return-Path: Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4EB02106566B for ; Sat, 7 Feb 2009 20:09:14 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21]) by mx1.freebsd.org (Postfix) with ESMTP id 20AE78FC17 for ; Sat, 7 Feb 2009 20:09:14 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.14.3/8.14.3) with ESMTP id n17K9D29037708 for ; Sat, 7 Feb 2009 20:09:13 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.14.3/8.14.3/Submit) id n17K9Dn0037687; Sat, 7 Feb 2009 20:09:13 GMT (envelope-from nobody) Message-Id: <200902072009.n17K9Dn0037687@www.freebsd.org> Date: Sat, 7 Feb 2009 20:09:13 GMT From: Naoyuki Tai To: freebsd-gnats-submit@FreeBSD.org Subject: powerd is not responsive enough for Intel CPUs with many CPU speed-steps X-Send-Pr-Version: www-3.1 X-GNATS-Notify: >Number: 131473 >Category: kern >Synopsis: powerd(8) is not responsive enough for Intel CPUs with many CPU speed-steps >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-acpi >State: closed >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Sat Feb 07 20:10:05 UTC 2009 >Closed-Date: Tue Feb 10 18:15:50 UTC 2009 >Last-Modified: Tue Feb 10 18:15:50 UTC 2009 >Originator: Naoyuki Tai >Release: FreeBSD 7.1-RELEASE >Organization: >Environment: FreeBSD nile.smartfruit.com 7.1-RELEASE FreeBSD 7.1-RELEASE #0: Sun Feb 1 14:11:35 EST 2009 root@nile.smartfruit.com:/usr/obj/usr/src/sys/NILE i386 >Description: I have a machine with following freq_levels. dev.cpu.0.freq_levels: 1733/27000 1516/23625 1333/21000 1166/18375 1067/17000 933/14875 800/13000 700/11375 600/9750 500/8125 400/6500 300/4875 200/3250 100/1625 There are 14 levels. powerd pushes up 2 levels at a time, and comes down 1 at a time. This makes the machine quite sluggish for many of interactive/event driven applications. Also, coming down is unnecessary long. In short, when there are many freq_levels, bumping up the speed needs to take the number of levels into account. If the step-up steps are too large, the machine eats unnecessary power, as the CPU speed goes up too fast, so the balance should be considered, but fixed 2 steps seems is too limited for the machine with many freq_levels. Perhaps, the right approach is to let you choose how much latency you'd expect for the CPU to get to the maximum speed. For example, you you say 300ms to get to the max CPU speed, you need to jump up the third of freq_levels for every 100ms. >How-To-Repeat: Do any user interaction, or run a database, web server etc that takes any user interaction. >Fix: To make the speed-up propotional to the number of levels, step-up steps to be derived from the number of available CPU frequencies. I changed the powerd.c as follows. This makes the CPU full speped in 4*100ms, instead of 7*100ms. (14/3 = 4 so it needs max of 4 iterations of powerd to get full speed.) nile# diff powerd.c.orig powerd.c 588c588 < * If we're idle less than the active mark, bump up two levels. --- > * If we're idle less than the active mark, bump up a few levels. 597c597,599 < i -= 2; --- > int steps = (numfreqs / 3); > if (steps < 2) steps = 2; > i -= steps; >Release-Note: >Audit-Trail: Responsible-Changed-From-To: freebsd-i386->freebsd-acpi Responsible-Changed-By: gavin Responsible-Changed-When: Tue Feb 10 13:57:25 UTC 2009 Responsible-Changed-Why: Although not strictly acpi-related, this seems to be where most of the work on powerd(1) takes place. Over to interested parties. http://www.freebsd.org/cgi/query-pr.cgi?pr=131473 State-Changed-From-To: open->closed State-Changed-By: mav State-Changed-When: Tue Feb 10 18:14:47 UTC 2009 State-Changed-Why: This is duplicate PR. The problem already fixed in 7-STABLE. http://www.freebsd.org/cgi/query-pr.cgi?pr=131473 >Unformatted: