linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Espiritu, Civ Kenneth" <EspiritK@mcguire.af.mil>
To: linux-mm@kvack.org
Subject: Fix to swap_out()
Date: Mon, 17 Apr 2000 17:51:25 -0400	[thread overview]
Message-ID: <3B51127C9576D3119B8300805FA70A8502536B34@clptflw4.mcguire.af.mil> (raw)

Hi,

I'm taking a little break from Redcode (Corewar) programming and 
decided to look a little at Linux's internals.

>From a BSD guru:
     * To locate pages to swap out, it takes a pass through the task list.
       Ostensibly it locates the task with the largest RSS to then try to
       swap pages out from rather then select pages that are not in use.
       From my read of the code, it also botches this badly.

I also looked at the code and it didn't look too nice. The offending
line is 365, where we pick the largest Resident Size Set (RSS) to swap
first.

A fix would be to pick tasks to page which don't page fault alot by
calculating a page fault rate over the task's lifespan. If the system
inadvertently pages something that it shouldn't there is feedback
from p->maj_flt which will make the task less likely to be swapped
out in future swap attempts.

An optimization to the fix would be to remove the +1 in the denominator
 if p->maj_flt was initialized to 1 when the task is first created (I think
in
/kernel/fork.c).

What are your thoughts on this fix?

Ken Espiritu

from /mm/vmscan.c (2.3.99-pre5)

363                         /* Refresh swap_cnt? */
364                         if (assign == 1)
365                                 mm->swap_cnt = mm->rss;
366                         if (mm->swap_cnt > max_cnt) {
367                                 max_cnt = mm->swap_cnt;
368                                 best = mm;
369                                 pid = p->pid;
370                         }

Fix:
365                                 mm->swap_cnt =
(jiffies-p->start_time)/(p->maj_flt+1);
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux.eu.org/Linux-MM/

                 reply	other threads:[~2000-04-17 21:46 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=3B51127C9576D3119B8300805FA70A8502536B34@clptflw4.mcguire.af.mil \
    --to=espiritk@mcguire.af.mil \
    --cc=linux-mm@kvack.org \
    /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