[ltp] HD Noise

Volker Franz volker.franz at tuebingen.mpg.de
Fri Apr 11 15:52:46 CEST 2003


I had the same problem, and played with the vm/bdflush settings, as
suggested in a number of newsgroups. In my case
(Debian/Woody/Thinkpad/600E) it helped, such that the harddisk
intervals are longer, but only in battery mode, not if the machine is
connected to a power supply (here, the harddisk simply runs all the
time and produces noise--noise--noise).

*** Does anybody know, how to change this difference between battery and power mode? ***

Appended find a script which I used for playing with the bdflush
settings. After finding YOUR VALUES :-), you can add them to
/etc/sysctl.conf. For example like this:

vm/bdflush = 60 0 0 0 50000 20000 70 0 0 

Please let me know, if you found a better solution...

Best
Volker
--

#!/bin/sh

echo 'After finding the appropriate values, set values in: /etc/sysctl.conf'
echo 'For testing the file /etc/sysctl.conf, do: sysctl -p'
echo ''
echo 'Old values: '
sudo /sbin/sysctl -A|grep flush|dcompact

nfract=100       #Percentage of buffer cache dirty to activate bdflush                               
dummy1=0        #old "ndirty"                                                                       
dummy2=0        #old "nrefill"                                                                      
dummy3=0        #unused                                                                             
interval=50000  #jiffies delay between kupdate flushes                                      
age_buffer=20000 #Time for normal buffer to age                                              
nfract_sync=90  #Percentage of buffer cache dirty to activate bdflush synchronously              
dummy4=0        #unused                                                                             
dummy5=0        #unused                                                                             

echo 'Setting values: '
sudo /sbin/sysctl -w vm/bdflush="$nfract $dummy1 $dummy2 $dummy3 $interval $age_buffer $nfract_sync $dummy4 $dummy5"

echo 'New values: '
sudo /sbin/sysctl -A|grep flush|dcompact


# ======================================================================
# VF: DEFAULT was:
#    vm/bdflush = 
#    40     nfract;  /* Percentage of buffer cache dirty to activate bdflush */                              
#    0      dummy1;  /* old "ndirty" */                                                                      
#    0      dummy2;  /* old "nrefill" */                                                                     
#    0      dummy3;  /* unused */                                                                            
#    500    interval;        /* jiffies delay between kupdate flushes */                                     
#    3000   age_buffer;      /* Time for normal buffer to age */                                             
#    60     nfract_sync;/* Percentage of buffer cache dirty to activate bdflush synchronously */             
#    0      dummy4;  /* unused */                                                                            
#    0      dummy5;  /* unused */                                                                            
# ======================================================================
# VF from: /usr/share/doc/kernel-doc-2.4.17/Documentation/sysctl/vm.txt:

#    This file contains the documentation for the sysctl files in
#    /proc/sys/vm and is valid for Linux kernel version 2.2.

#    The files in this directory can be used to tune the operation
#    of the virtual memory (VM) subsystem of the Linux kernel, and
#    one of the files (bdflush) also has a little influence on disk
#    usage.

#    Default values and initialization routines for most of these
#    files can be found in mm/swap.c.

#    Currently, these files are in /proc/sys/vm:
#    - bdflush
#    - buffermem
#    - freepages
#    - kswapd
#    - overcommit_memory
#    - page-cluster
#    - pagecache
#    - pagetable_cache

#    ==============================================================

#    bdflush:

#    This file controls the operation of the bdflush kernel
#    daemon. The source code to this struct can be found in
#    linux/fs/buffer.c. It currently contains 9 integer values,
#    of which 4 are actually used by the kernel.

#    From linux/fs/buffer.c:
#    --------------------------------------------------------------
#    union bdflush_param {
#            struct {
#                    int nfract;  /* Percentage of buffer cache dirty to 
#                                       activate bdflush */
#                    int dummy1;  /* old "ndirty" */
#                    int dummy2;  /* old "nrefill" */
#                    int dummy3;  /* unused */
#                    int interval;        /* jiffies delay between kupdate flushes */
#                    int age_buffer;      /* Time for normal buffer to age */
#                    int nfract_sync;/* Percentage of buffer cache dirty to 
#                                       activate bdflush synchronously */
#                    int dummy4;  /* unused */
#                    int dummy5;  /* unused */                                           
#            } b_un;
#            unsigned int data[N_PARAM];
#    } bdf_prm = {{30, 64, 64, 256, 5*HZ, 30*HZ, 60, 0, 0}};
#    --------------------------------------------------------------

#    int nfract:
#    The first parameter governs the maximum number of dirty
#    buffers in the buffer cache. Dirty means that the contents
#    of the buffer still have to be written to disk (as opposed
#    to a clean buffer, which can just be forgotten about).
#    Setting this to a high value means that Linux can delay disk
#    writes for a long time, but it also means that it will have
#    to do a lot of I/O at once when memory becomes short. A low
#    value will spread out disk I/O more evenly, at the cost of
#    more frequent I/O operations.  The default value is 30%,
#    the minimum is 0%, and the maximum is 100%.

#    int interval:
#    The fifth parameter, interval, is the minimum rate at
#    which kupdate will wake and flush.  The value is expressed in
#    jiffies (clockticks), the number of jiffies per second is
#    normally 100 (Alpha is 1024). Thus, x*HZ is x seconds.  The
#    default value is 5 seconds, the minimum is 0 seconds, and the
#    maximum is 600 seconds.

#    int age_buffer:
#    The sixth parameter, age_buffer, governs the maximum time
#    Linux waits before writing out a dirty buffer to disk.  The
#    value is in jiffies.  The default value is 30 seconds,
#    the minimum is 1 second, and the maximum 6,000 seconds.

#    int nfract_sync:
#    The seventh parameter, nfract_sync, governs the percentage
#    of buffer cache that is dirty before bdflush activates
#    synchronously.  This can be viewed as the hard limit before
#    bdflush forces buffers to disk.  The default is 60%, the
#    minimum is 0%, and the maximum is 100%.
# ======================================================================




More information about the Linux-Thinkpad mailing list