Re: [patch-2.3.43-pre5] optimizing cleanup of kernel/exit.c

From: Mike Coleman (mkc@kc.net)
Date: Wed Feb 09 2000 - 14:13:02 EST


Tigran Aivazian <tigran@sco.COM> writes:
> This simple restructuring of sys_wait4() not only makes it more readable
> (because of less pressure on tab'd space) but also saves the precious 16
> bytes of kernel text:
>
> Before
> ======
> text data bss dec hex filename
> 1383321 257386 413440 2054147 1f5803 vmlinux
>
> After
> =====
>
> text data bss dec hex filename
> 1383305 257386 413440 2054131 1f57f3 vmlinux

The patch is more readable, but it looks like it's also a bit slower. If
state is TASK_STOPPED but exit_code is 0, we end up (uselessly) testing state
a second time, since it is volatile. I haven't tried, but I believe this
would be fixed by swapping the two tests (test for TASK_ZOMBIE first).

Also, when I tried this, it looks like the text size for exit.o is the same
before and after, so I'm not sure why the size of vmlinux varies.

--Mike

# md5sum exit.c exit.o exit.c-tigran exit.o-tigran
fe1e76a559e36f31fcecede026819e52 exit.c
89994fee7aa4d746d6441fecf235a1fc exit.o
85465171760971b38a759b3a3995a0b9 exit.c-tigran
1896dcf31e08492cb2a946acfa8f17de exit.o-tigran
# size exit.o exit.o-tigran
   text data bss dec hex filename
   4165 0 0 4165 1045 exit.o
   4165 0 0 4165 1045 exit.o-tigran

-- patched version
.L2019:
        movl (%ebx),%eax
        movl $1,%ecx
        cmpl $8,%eax # TASK_STOPPED
        jne .L2022
        cmpl $0,84(%ebx) # p->exit_code
        je .L2022 # this jumps to a check against TASK_ZOMBIE
                            # since state is volatile
        testb $2,76(%esp)
        jne .L2023
        testb $16,4(%ebx)
        je .L2008

-- 
Any sufficiently adverse technology is indistinguishable from Microsoft.

- 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 : Tue Feb 15 2000 - 21:00:15 EST