lkml.org 
[lkml]   [1998]   [Sep]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: 2.1.118 Tons of oopes (arms waving violently!!!)
Date
> Potentially. I've thought about it on and off, but it's painful to add the
> entries to every single driver, and the win has never been very big.
>

Did you see my message on this? You can do auto initialization in register_blkdev.
Additionally, my suggestion changes the device arrays to simply hardwire invalid
devices to a fops which simply returns 0 (or NULL or whatever) when it hits a bad
device.

The math is pretty simple:

right now, we're loading the struct from the device array, checking a pointer in
the structure, then we're executing that or returning NULL.

My method was to simply preset all the NULL entries in register_blkdev to point
to the generic case equivelent and blindly call the function with a simple inline
macro:

#define function(dev) do { \
device_array[MAJOR(dev)]->function(dev); \
} while(0)
It's simple, it's elegant and it leverages precomputed tables all over the place.
I would reckon that we could gain a usec or more in benchmarks with this optimization.

> Also note that many of the current NULL checks (not the ones for the fops
> thing, but for other things) are superfluous: we check for NULL not
> because we need to, but often because it's just an almost automatic thing
> for me.
>
> For example, there is sometimes code essentially like this (see
> sys_lseek(), for example)
>
> struct dentry * dentry;
> struct inode * inode;
> struct file * filp = fget(fd);
>
> if (!filp)
> return -EBADF;
>
> dentry = filp->f_dentry;
> if (!dentry)
> return -EBADF;
>
> inode = dentry->d_inode;
> if (!inode)
> return -BADF;
>
> and the only check that needs to be done is really the filp one: if you
> get a filp that is active, then the dentry and inode had better be there,
> because it would be a major error (worthy of a kernel oops) if they
> weren't, so checking for dentry/inode being non-NULL is unnecessary, but
> often done simply because I and others have been anal about it.
>
> Personally, I would suggest against changing all the file and inode
> operations unless somebody can show cases where it makes a real-world
> difference in performance..
>
> Linus
>
>
> -
> 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.altern.org/andrebalsa/doc/lkml-faq.html
>


--
Perry Harrington Linux rules all OSes. APSoft ()
email: perry@apsoft.com Think Blue. /\

-
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.altern.org/andrebalsa/doc/lkml-faq.html

\
 
 \ /
  Last update: 2005-03-22 13:44    [W:0.046 / U:0.556 seconds]
©2003-2014 Jasper Spaans. Advertise on this site