Re: Interesting analysis of linux kernel threading by IBM

From: James A Simmons (jsimmons@acsu.buffalo.edu)
Date: Wed Jan 19 2000 - 11:05:23 EST


On Tue, 18 Jan 2000, Kabra, Anant wrote:

> I don't know if people have read this yet, but looks like some good analysis
> of linux kernel threading by IBM
>
> http://www-4.ibm.com/software/developer/library/java2/index.html
>

I read it. It was a excellent paper. I'm amazed by just rearranging the
data in task_struct it reduces the time in the schedular up to 30% on
Pentium II. I have the patch included below. Anyone working on a
many-to-many model for threads for linux?

diff -Naur linux-2.3.28/include/linux/sched.h linux-2.3.28.new/include/linux/sc
hed.h
--- linux-2.3.28/include/linux/sched.h Mon Dec 6 18:14:12 1999
+++ linux-2.3.28.new/include/linux/sched.h Mon Dec 6 18:13:30 1999
@@ -274,17 +274,19 @@
        struct exec_domain *exec_domain;
        volatile long need_resched;

-/* various fields */
+ cycles_t avg_slice;
+ int lock_depth; /* Lock depth. We can context switch in and out
 of holding a syscall kernel lock... */
+/* begin intel cache line */
        long counter;
        long priority;
- cycles_t avg_slice;
-/* SMP and runqueue state */
+ unsigned long policy;
+/* memory management info */
+ struct mm_struct *mm, *active_mm;
        int has_cpu;
        int processor;
- int last_processor;
- int lock_depth; /* Lock depth. We can context switch in and out
 of holding a syscall kernel lock... */
- struct task_struct *next_task, *prev_task;
        struct list_head run_list;
+ struct task_struct *next_task, *prev_task;
+ int last_processor;

 /* task state */
        struct linux_binfmt *binfmt;
@@ -313,7 +315,7 @@

        wait_queue_head_t wait_chldexit; /* for wait4() */
        struct semaphore *vfork_sem; /* for vfork() */
- unsigned long policy, rt_priority;
+ unsigned long rt_priority;
        unsigned long it_real_value, it_prof_value, it_virt_value;
        unsigned long it_real_incr, it_prof_incr, it_virt_incr;
        struct timer_list real_timer;
@@ -346,10 +348,6 @@
        struct fs_struct *fs;
 /* open file information */
        struct files_struct *files;
-
-/* memory management info */
- struct mm_struct *mm, *active_mm;
-
 /* signal handlers */
        spinlock_t sigmask_lock; /* Protects signal and blocked */
        struct signal_struct *sig;
@@ -398,16 +396,20 @@
  */
 #define INIT_TASK(name) \
 /* state etc */ { 0,0,0,KERNEL_DS,&default_exec_domain,0, \
-/* counter */ DEF_PRIORITY,DEF_PRIORITY,0, \
-/* SMP */ 0,0,0,-1, \
-/* schedlink */ &init_task,&init_task, LIST_HEAD_INIT(init_task.run_lis
t), \
+/* avg_slice */ 0, -1, \
+/* counter */ DEF_PRIORITY,DEF_PRIORITY,SCHED_OTHER, \
+/* mm */ NULL, &init_mm, \
+/* has_cpu * 0,0, \
+/* run_list */ LIST_HEAD_INIT(init_task.run_list), \
+/* next_task */ &init_task,&init_task, \
+/* last_proc */ 0, \
 /* binfmt */ NULL, \
 /* ec,brk... */ 0,0,0,0,0,0, \
 /* pid etc.. */ 0,0,0,0,0, \
 /* proc links*/ &init_task,&init_task,NULL,NULL,NULL, \
 /* pidhash */ NULL, NULL, \
 /* chld wait */ __WAIT_QUEUE_HEAD_INITIALIZER(name.wait_chldexit), NULL
, \
-/* timeout */ SCHED_OTHER,0,0,0,0,0,0,0, \
+/* timeout */ 0,0,0,0,0,0,0, \
 /* timer */ { NULL, NULL, 0, 0, it_real_fn }, \
 /* utime */ {0,0,0,0},0, \
 /* per CPU times */ {0, }, {0, }, \
@@ -426,7 +428,6 @@
 /* thread */ INIT_THREAD, \
 /* fs */ &init_fs, \
 /* files */ &init_files, \
-/* mm */ NULL, &init_mm, \
 /* signals */ SPIN_LOCK_UNLOCKED, &init_signals, {{0}}, {{0}}, NULL, &init_ta
sk.sigqueue, 0, 0, \
 /* exec cts */ 0,0, \
 /* exit_sem */ __MUTEX_INITIALIZER(name.exit_sem), \

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sun Jan 23 2000 - 21:00:20 EST