Re: lockless poll() (was Re: namei() query)

From: Manfred Spraul (manfreds@colorfullife.com)
Date: Mon Apr 24 2000 - 08:38:26 EST


kumon@flab.fujitsu.co.jp wrote:
>
> 171 198 179 151 699 sys_newstat+79 0xc026b7e4
>

It would be possible to optimize this one slightly:

replace
        lock_kernel();
        dentry = namei(filename);

with
        {
                char *name;
                name = getname(filename);
                if(IS_ERR(name))
                        return PTR_ERR(name);
                lock_kernel();
                dentry = lookup_dentry(name,);
                putname(name);
        }

[ or a new "lock_and_namei()" function]
getname() is SMP safe, and many functions call it before lock_kernel()
[sys_rename(), sys_link()].

I made a quick benchmark (for(;;) stat("/bin")), and the kernel spends
30 % in get_name(), strncpy_from_user, rmqueue and __alloc_pages() [but
debugging options enabled, 2.2.12-20smp spends ~ 15 % in these
functions]

>
> 172 146 190 159 667 sys_open+132 0xc026b7e4
>

getname() should be moved before lock_kernel(), but I doubt that this
will have a noticeable effect.

--
	Manfred

- 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 Apr 30 2000 - 21:00:07 EST