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

From: Manfred Spraul (
Date: Mon Apr 24 2000 - 09:31:45 EST

Searching for SMP races transforms your brain to jelly:

We should start with the obvious optimization:
kmalloc(PAGE_SIZE,GFP_KERNEL) is vastly faster than

I replaced getname()/putname() with kmalloc, and now stat("/bin") is ~25
% faster (from 2241 down to 1638 cpu ticks)

As an second optimization, we might try to optimize kmalloc for fixed
size allocations:
with __builtin_constant_p() we could directly allocate from the correct
cs_cachep without the loop in kmalloc().


--- 2.3/include/linux/fs.h Wed Apr 12 15:00:31 2000 +++ build-2.3/include/linux/fs.h Mon Apr 24 15:53:10 2000 @@ -847,8 +847,11 @@ extern struct file * dentry_open(struct dentry *, struct vfsmount *, int); extern int filp_close(struct file *, fl_owner_t id); extern char * getname(const char *); -#define __getname() ((char *) __get_free_page(GFP_KERNEL)) -#define putname(name) free_page((unsigned long)(name)) +/* forward declarations */ +extern void *kmalloc(size_t, int); +extern void kfree(const void *); +#define __getname() ((char *) kmalloc(PAGE_SIZE, GFP_KERNEL)) +#define putname(name) kfree((name)) enum {BDEV_FILE, BDEV_SWAP, BDEV_FS, BDEV_RAW}; extern void kill_fasync(struct fasync_struct *, int, int);

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to Please read the FAQ at

This archive was generated by hypermail 2b29 : Sun Apr 30 2000 - 21:00:07 EST