From: "अभिजित भोपटकर (Abhijit Bhopatkar)" <bainonline@gmail.com>
To: "Linux Kernel list" <linux-kernel@vger.kernel.org>,
"Linus Torvalds" <torvalds@osdl.org>,
akpm@osdl.org, jgarzik@pobox.com
Subject: [PATCH] [RFC] Throttle swappiness for interactive tasks
Date: Wed, 18 Apr 2007 17:40:53 +0530 [thread overview]
Message-ID: <2ff216280704180510w28136a6cw6816f834593aff13@mail.gmail.com> (raw)
The mm structures of interactive tasks are marked and
the pages belonging to them are never shifted to inactive
list in lru algorithm. Thus keeping interactive tasks in
memory as long as possible.
The interactivity is already determined by schedular so
we reuse that knowledge to mark the mm structures.
Signed-off-by: Abhijit Bhopatkar <bainonline@gmail.com>
---
include/linux/init_task.h | 1 +
include/linux/sched.h | 4 ++++
kernel/sched.c | 4 ++++
mm/rmap.c | 5 +++++
4 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/include/linux/init_task.h b/include/linux/init_task.h
index a2d95ff..12ba3c1 100644
--- a/include/linux/init_task.h
+++ b/include/linux/init_task.h
@@ -54,6 +54,7 @@
.page_table_lock = __SPIN_LOCK_UNLOCKED(name.page_table_lock), \
.mmlist = LIST_HEAD_INIT(name.mmlist), \
.cpu_vm_mask = CPU_MASK_ALL, \
+ .interactive = 0, \
}
#define INIT_SIGNALS(sig) { \
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 49fe299..1f233e7 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -373,6 +373,10 @@ struct mm_struct {
/* aio bits */
rwlock_t ioctx_list_lock;
struct kioctx *ioctx_list;
+
+ /* interactivity flag */
+ unsigned char interactive;
+
};
struct sighand_struct {
diff --git a/kernel/sched.c b/kernel/sched.c
index b9a6837..72caf94 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -746,6 +746,10 @@ static inline int __normal_prio(struct task_struct *p)
prio = MAX_RT_PRIO;
if (prio > MAX_PRIO-1)
prio = MAX_PRIO-1;
+
+ /* Update interactivity flag in mm if interactive. */
+ if(p->mm && TASK_INTERACTIVE(p))
+ p->mm->interactive = 1;
return prio;
}
diff --git a/mm/rmap.c b/mm/rmap.c
index b82146e..0735168 100644
--- a/mm/rmap.c
+++ b/mm/rmap.c
@@ -317,6 +317,11 @@ static int page_referenced_one(struct page *page,
rwsem_is_locked(&mm->mmap_sem))
referenced++;
+ /* Pretend the page is referenced if the task is
+ interactive. */
+ if (mm != current->mm && mm->interactive)
+ referenced++;
+
(*mapcount)--;
pte_unmap_unlock(pte, ptl);
out:
--
1.4.4.2
next reply other threads:[~2007-04-18 12:10 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-18 12:10 अभिजित भोपटकर (Abhijit Bhopatkar) [this message]
2007-04-18 17:04 ` Chris Snook
2007-04-18 20:52 ` Rik van Riel
[not found] ` <2ff216280704182014h6ff2eed3g4301ee8d1bfbed14@mail.gmail.com>
2007-04-19 4:29 ` Rik van Riel
2007-04-19 5:22 ` Abhijit Bhopatkar
2007-04-19 7:07 ` Rik van Riel
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=2ff216280704180510w28136a6cw6816f834593aff13@mail.gmail.com \
--to=bainonline@gmail.com \
--cc=akpm@osdl.org \
--cc=jgarzik@pobox.com \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@osdl.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
all inboxes | Powered by JetHome®