mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sasha Pachev <sasha@mysql.com>
To: linux-kernel@vger.kernel.org, riel@conectiva.com.br
Subject: disabling kswapd
Date: Fri, 21 Dec 2001 18:17:20 -0700	[thread overview]
Message-ID: <200112220117.fBM1HLM00755@mysql.sashanet.com> (raw)

Rik:

My original message for some reason did not seem to make it to the list, so I 
am resending this (with some modifications).

I have noticed that kswapd still runs and in when the memory is low, will do 
some hard thinking about what to swap even if the system does not have a swap 
partition. Here is the proof:

sasha@mysql:/usr/src/linux/mm > free
             total       used       free     shared    buffers     cached
Mem:        254816     248476       6340          0      27224      48832
-/+ buffers/cache:     172420      82396
Swap:            0          0          0
sasha@mysql:/usr/src/linux/mm > ps auxw | grep kswapd
root         5  0.1  0.0     0    0 ?        SW   Dec19   1:41 [kswapd]
sasha    25619  0.0  0.2  1552  612 pts/7    S    20:34   0:00 grep kswapd

So in this example kswapd essentially wasted 1 min and 41 sec of CPU time.

I have search through the archive and discovered a patch to disable kswapd 
through proc at 
http://www.uwsg.iu.edu/hypermail/linux/kernel/0108.0/0675.html. I adapted it 
to my kernel ( 2.4.17-rc2), disabled kswapd, did some testing and noticed 
much better performance.

I would like to request that the above patch in some form be officially 
included in the kernel. While a *perfectly working* kswapd on a system with 
many different processes behaving in a somewhat unpredicatable manner will be 
a boon, there are many instances when running kswapd does more harm than 
good. Below are three reasons why a sysadmin may want to have kswapd disabled:

  * the system is configured in such a way that it has plenty of RAM for 
buffers,cache, and all the processes it will ever run. For example, a 
dedicated server machine with lots of RAM, a small server binary, and a set 
of files it reads that alltogether will fit into RAM - many MySQL 
installations fit into this category. Running kswapd in this case would only 
be a waste of CPU

 * kswapd has a nasty bug that hogs CPU, causes kernel panic, or swaps out so 
aggressively that the system becomes unusable.

 * some other code in the kernel does not work well with kswapd - the 
particular problem I've run into, for example, was kswapd going crazy trying 
to shrink the buffers while find / was causing the kernel to expand them. The 
result was kswapd taking up 75% of CPU.

The bottom line is that a sysadmin should have a choice ( isn't that what 
Linux is all about, after all?). If he does not want to run kswapd, he should 
not have to. If he is really wrong in this, let him find out for himself.

-- 
MySQL Development Team
For technical support contracts, visit https://order.mysql.com/
   __  ___     ___ ____  __ 
  /  |/  /_ __/ __/ __ \/ /   Sasha Pachev <sasha@mysql.com>
 / /|_/ / // /\ \/ /_/ / /__  MySQL AB, http://www.mysql.com/
/_/  /_/\_, /___/\___\_\___/  Provo, Utah, USA
       <___/                  

             reply	other threads:[~2001-12-22  1:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-12-22  1:17 Sasha Pachev [this message]
2001-12-22  4:44 ` Rik van Riel
2001-12-22 16:31   ` Sasha Pachev

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200112220117.fBM1HLM00755@mysql.sashanet.com \
    --to=sasha@mysql.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=riel@conectiva.com.br \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®