LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   With Linux more waste of resource as with Windows (https://www.linuxquestions.org/questions/slackware-14/with-linux-more-waste-of-resource-as-with-windows-833399/)

Squall90 09-20-2010 02:54 PM

With Linux more waste of resource as with Windows
 
Hi,

since last Friday I have my new PC. I installed Slackware as well as Windows (for some Games). Under Windows I have a program to regulate the perfomance, so if I do nothing or simple things that do not need the full power, my PC is quiet and uses less power (I can see it with Watt/Ampere meter...). I have currently around 155 Watt and the CPU fan is really loud -- compared to Windows.
Is there any way to regulate this with Linux?

My mainboard is an Asus M4N75TD and I have an AMD Phenom II X4 965 CPU.

Thanks.

dugan 09-20-2010 03:13 PM

You need to make sure CPU frequency scaling is turned on and set to "ondemand". Most Linux distributions do not set that up out of the box.

Run lsmod | grep powernow-k8 to confirm that your CPU frequency scaling module is loaded. If it isn't, execute modprobe powernow-k8 and add the command to rc.local.

Then set your CPU frequency scaling governor to "ondemand":
Code:

ls /sys/devices/system/cpu*/cpufreq/scaling_governor | xargs -i echo ondemand > {}
Put that command in rc.local too.

BobNutfield 09-20-2010 03:14 PM

You will want to look into CPU frquency scaling which is availble in Slackware. There are a number of guides for this, but here is one:

DELETED THE LINK. dugan's info is all that you need.

Bob

Squall90 09-20-2010 03:36 PM

Quote:

Originally Posted by dugan (Post 4103717)
You need to make sure CPU frequency scaling is turned on and set to "ondemand". Most Linux distributions do not set that up out of the box.

Run lsmod | grep powernow-k8 to confirm that your CPU frequency scaling module is loaded. If it isn't, execute modprobe powernow-k8 and add the command to rc.local.

Then set your CPU frequency scaling governor to "ondemand":
Code:

ls /sys/devices/system/cpu*/cpufreq/scaling_governor | xargs -i echo ondemand > {}
Put that command in rc.local too.

Thanks. I added it. Until now, no changes. :S

Your "change" in /sys has a little typo, it must be:
Code:

ls /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor | xargs -i echo ondemand > {}
Now I'm waiting for some mysterious things to happen. ^^ Perhaps I should read a bit about PowerNow -- with my old PC I didn't care because it was years old and I didn't have a wattmeter. :D
_____________________________________________

While I was adding your two commands to rc.local I was considering to move modprobe powernow-k8 to rc.modules and then I found this:
Code:

### Enable CPU frequency scaling if requested:
if [ "$CPUFREQ" = "on" ]; then
  ### CPU frequency scaling modules for the Linux kernel CPUfreq subsystem.
  #
  # Clock scaling allows you to change the clock speed of the CPUs on the fly.
  # This is a nice method to save battery power, because the lower the clock
  # speed is, the less power the CPU consumes.
  #
  # It should not hurt anything to try to load these modules.
  #
  # generic ACPI P-States based driver:
  /sbin/modprobe acpi-cpufreq 2>/dev/null
  # AMD mobile K6-2/3+ PowerNow!:
  /sbin/modprobe powernow-k6 2>/dev/null
  # AMD mobile Athlon PowerNow!:
  /sbin/modprobe powernow-k7 2>/dev/null
  # AMD Cool&Quiet PowerNow!:
  /sbin/modprobe powernow-k8 2>/dev/null
  # Intel SpeedStep using the SMI BIOS interface:
  /sbin/modprobe speedstep-smi 2>/dev/null
  # Intel SpeedStep on ICH-based chipsets:
  /sbin/modprobe speedstep-ich 2>/dev/null
  # Intel Enhanced SpeedStep :
  /sbin/modprobe speedstep-centrino 2>/dev/null
  # Intel Pentium4/Xeon clock modulation is not enabled by default.
  # The kernel documentation says "This adds the CPUFreq driver for Intel
  # Pentium 4 / XEON processors.  When enabled it will lower CPU temperature
  # by skipping clocks.  This driver should be only used in exceptional
  # circumstances when very low power is needed because it causes severe
  # slowdowns and noticeable latencies.  Normally Speedstep should be used
  # instead."
  # If you still want to try the Pentium4/Xeon module, uncomment the next line:
  #/sbin/modprobe p4-clockmod 2>/dev/null
  # NatSemi Geode GX / Cyrix MediaGXm:
  /sbin/modprobe gx-suspmod  2>/dev/null
  # Transmeta Crusoe / Efficeon LongRun:
  /sbin/modprobe longrun  2>/dev/null
  # VIA Cyrix Longhaul:
  /sbin/modprobe longhaul  2>/dev/null
  # nForce2 FSB changing cpufreq driver:
  /sbin/modprobe cpufreq-nforce2 2>/dev/null
  # Enhanced PowerSaver driver for VIA C7 CPUs:
  /sbin/modprobe e_powersaver 2>/dev/null

  ### CPU frequency scaling policies:
  #
  # Use the CPUFreq governor 'powersave' as default.  This sets the
  # frequency statically to the lowest frequency supported by the CPU.
  #/sbin/modprobe cpufreq_powersave
  #
  # Use the CPUFreq governor 'performance' as default. This sets the
  # frequency statically to the highest frequency supported by the CPU.
  #/sbin/modprobe cpufreq_performance
  #
  # Use the CPUFreq governor 'conservative' as default.  This allows you
  # to get a full dynamic frequency capable system by simply loading your
  # cpufreq low-level hardware driver.  Be aware that not all cpufreq
  # drivers support the 'conservative' governor -- the fallback governor
  # will be the 'performance' governor.
  #/sbin/modprobe cpufreq_conservative
  #
  # Use the CPUFreq governor 'ondemand' as default.  This allows you to
  # get a full dynamic frequency capable system by simply loading your
  # cpufreq low-level hardware driver.  Be aware that not all cpufreq
  # drivers support the 'ondemand' governor -- the fallback governor will
  # be the performance governor.  This seems to be the most-recommended
  # scaling policy, so rc.modules will try to load this by default.
  /sbin/modprobe cpufreq_ondemand 2>/dev/null

  ### CPU scaling governor:
  #
  # Set the default scaling_governor to be used (such as userspace or ondemand)
  # if there is a CPUFreq scaling policy module loaded that supports it:
  SCALING_GOVERNOR=ondemand
  #
  # Try to enable the scaling_governor selected above:
  if [ -r /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors ]; then
    if grep -wq "$SCALING_GOVERNOR" /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors ; then
      if [ -r /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor ]; then
        for SYSCPUFILE in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor ; do
          echo "$SCALING_GOVERNOR" > $SYSCPUFILE
        done
      fi
    fi
  fi

fi # End enabling CPU scaling support

I should probably set $CPUFREQ somewhere to "on" instead?
____

OK, some lines above this code I pasted is the declaration of $CPUFREQ. I set it to "on" and restartd and saw an output at start time:
Quote:

powernow: This module only works with AMD K7 CPUs
powernow-k8: Found 1 AMD Phenom(tm) II X4 965 Processor (4 cpu cores) (version 2.20.00)
powernow-k8: 0 : pstate 0 (3400 MHz)
powernow-k8: 1 : pstate 1 (2700 MHz)
powernow-k8: 2 : pstate 2 (2200 MHz)
powernow-k8: 3 : pstate 3 (800 MHz)
cpufreq-nforce2: No nForce2 chipset.
It seems to work, thank you. But I think I still need to read more about PowerNow.

dugan 09-20-2010 03:56 PM

If you want to see the effect, you can look at the "cpuinfo_max_freq" and "cpuinfo_cur_freq" files in each cpufreq directory, to see what your CPU is capable of and what it's been throttled to.

sparkyhall 09-20-2010 04:08 PM

All I had to do was change "CPUFREQ=battery" to "CPUFREQ=on" in /etc/rc.d/rc.modules to get frequency scaling to work on a Athlon II 235e. After this frequency scaling should start automatically next time you re-boot.

Ilgar 09-21-2010 12:00 PM

Also, those who really really want to reduce power consumption when idle can try turning off their cores:

Code:

echo 0 >> /sys/devices/system/cpu/cpu1/online
This is for core #2 (#1 is cpu0). On dual core systems, a single core waking up to high frequencies might be worse than two cores with light load, but I believe for 3 or more cores turning off unneeded cores may save power.

TobiSGD 09-21-2010 12:17 PM

Multicore-CPUs should bring unused cores to the different sleep-states, so I think turning cores off will not bring a noticable saving.
It will bring more to get it from the other end. Choose your PSU according to your needs, no need for a 600W-PSU in an office-pc. Choose models with high efficiency, at least with 80Plus certificate (have a look here: 80 Plus PSU List).
Also the graphicscard can be very power consuming. Choose your moddel according to your needs (again, no need for a gaming card in an office-pc) and read reviews on the Internet. I bought my graphicscard and recognized to late that my modell ha no powersaving options, because it is overclocked by the manufacturer.

Squall90 09-22-2010 02:17 AM

For office computers on-board graphic cards are OK, I think. They do their job and they probably need less power.


All times are GMT -5. The time now is 03:03 AM.