Linux-kernel mailing list archive 1999-32,: Re: how to bypass buffer cache for a block device driver

# Re: how to bypass buffer cache for a block device driver

T. P. Saravanan (sara@procsys.com)
Mon, 09 Aug 1999 20:09:44 +0530

- Messages sorted by: [ date ][ thread ][ subject ][ author ]
- Next message: Christer Weinigel: "Re: no driver change for 2.4?"
- Previous message: Werner Almesberger: "Re: Kernels > 1M"

Actually the custom hardware - a storage controller has lot of cache
in it, and there is this custom nic card which can access the this
cache memory in a "peer-to-peer" mode in a private data bus.

I want to optimize network related disk access by avoiding
buffer copies into the main RAM. (Nic card will directly pick up
data from storage controller card.)

I do not want apps running on the host machine itself to get
adversely impacted.
I was planning to bypass buffer cache for nfs *alone* - but now as
you've told me that's not possible I am wondering what could
be other way out.

I do not mind patching nfs server or writing device driver
but I do not want to patch the kernel as I finally want it
running on a stock kernel.

    ---

    How is the general problem of "peer-to-peer" access of hardware
    addressed in linux?   Is there a generic way hardware can pass
    data bypassing copies to host memory.

    ---

    Please post a copy to sara@procsys.com.  I am not on the mailing list.

    -Saravanan

    Alan Cox wrote:
    >
    > > Is it possible to bypass the buffer cache completely
    > > for a block device driver? What should I do?
    >
    > No
    >
    > > Is it possible to bypass only for some processes and
    > > let thro for others? (This is the final behaviour I want.)
    >
    > It is up to the process to specify O_SYNC on the files it wishes to sync.
    > Even then the Linux kernel will do read caching. The page cache shares pages
    > between user space and the kernel when running binaries for example.
    >
    > Also regardless of how good the cache on your custom device is the main memory
    > is referenced without a copy in read only cases so will be faster than a copy
    > even from static ram, or a DMA.
    >
    > Alan
    >
    >> I've a custom hardware with lot of inbuilt cache.
    >> I want to write a block device driver for it and i
    >> *want to bypass the buffer cache*.
    >> I intend to run filesystems on top of it.
    >>
    >> I filled in the "read" and "write" functions with my own versions
    >> and bypassed "block_read" and "block_write".
    >> I could "fdisk" but mount failed complaining about "request_fn".
    >>
    >> I filled in the "request_fn" and now, it appears to me
    >> that all io happens through "request_fn". For instance,
    >> "printk" lines in "read" and "write" print
    >> nothing.
    >>
    >> If i check the pid in "request_fn"  it is that
    >> of "kflushd" or "bdflush".
    >>
    >>---
    >>
    >> Is it possible to bypass the buffer cache completely
    >> for a block device driver? What should I do?
    >>
    >> Is it possible to bypass only for some processes and
    >> let thro for others? (This is the final behaviour I want.)
    >>
    >> Where should I look for more about block device
    >> drivers and their interaction with buffer cache (i.e. apart from
    >> code in terms of design, structure etc.,).
    >>
    >>---
    >>
    >> I am not on the mailing list, so please post a copy to
    >> "sara@procsys.com" too.
    >>
    >>---
    >>
    >> Thanks in advance
    >>
    >> Saravanan
    >>

    -
    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/

     Next message: Christer Weinigel: "Re: no driver change for 2.4?"
     Previous message: Werner Almesberger: "Re: Kernels > 1M"