public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] [RFC] Throttle swappiness for interactive tasks
@ 2007-04-18 12:10 अभिजित भोपटकर (Abhijit Bhopatkar)
  2007-04-18 17:04 ` Chris Snook
  2007-04-18 20:52 ` Rik van Riel
  0 siblings, 2 replies; 6+ messages in thread
From: अभिजित भोपटकर (Abhijit Bhopatkar) @ 2007-04-18 12:10 UTC (permalink / raw)
  To: Linux Kernel list, Linus Torvalds, akpm, jgarzik

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

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2007-04-19  7:11 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-04-18 12:10 [PATCH] [RFC] Throttle swappiness for interactive tasks अभिजित भोपटकर (Abhijit Bhopatkar)
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox