lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 18 Apr 2007 17:40:53 +0530
From:	"अभिजित भोपटकर (Abhijit Bhopatkar)" <bainonline@...il.com>
To:	"Linux Kernel list" <linux-kernel@...r.kernel.org>,
	"Linus Torvalds" <torvalds@...l.org>, akpm@...l.org,
	jgarzik@...ox.com
Subject: [PATCH] [RFC] Throttle swappiness for interactive tasks

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@...il.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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ