Kiobufs removed
[Posted October 15, 2002 by corbet]
One of the advantages of the new "commits" mailing list is that one can see
the patches which slip quietly into the kernel without public discussion.
One of those is
this patch by Christoph
Hellwig, via Andrew Morton, which removes the "kiobuf" infrastructure from
the kernel. This patch has been merged by Linus, and will show up in the
2.5.43 development kernel.
The kiobuf structure was developed by Stephen Tweedie as a way, initially,
of implementing the raw block I/O devices in the 2.3 development series.
Using kiobufs, kernel code can perform operations directly to and from
user-space buffers without having to worry about walking page tables,
pinning pages into memory, and so on. Kiobufs did the job they were
designed to do, and they found their way into a number of kernel
developments.
Not everybody was happy with the kiobuf interface, however. Many saw it as
a heavyweight structure, requiring a lot of time (and memory) to set up and
tear down. Kiobufs also forced the splitting of large I/O operations into
small chunks - often as small as a single 512-byte sector, but never larger
than 64KB. As a result, kiobufs never became the high-performance I/O
mechanism that it was intended to be.
So what replaces kiobufs in the 2.5 kernel? Modern direct I/O code uses
the get_user_pages() function:
int get_user_pages (struct task_struct *tsk,
struct mm_struct *mm,
unsigned long start, int len,
int write, int force,
struct page **pages,
struct vm_area_struct **vmas);
This function faults in len user pages starting at start,
and locks them into the page cache. Return values include the
struct page pointers (in pages) and pointers to the
associated VMA structures (in vmas); either can be NULL
if the caller is not interested in that information. Code which used
kiobufs will want the struct page pointers, which can be used
to set up DMA operations or other direct transfers; most callers do not
need the VMA pointers. The pages should be passed (individually) to
page_cache_release() when the operation is complete.
The asynchronous I/O patches have also, at times, included a new
kvec structure which looks like a lighter, faster version of
kiobufs. No patches with kvecs have been merged by Linus, however.
Kiobufs, meanwhile, have reached a dead end. It's worth remembering,
though, that kiobufs were the pioneering effort into the use of
struct page pointers for direct I/O. The code may be gone,
but the lessons learned from kiobufs live on in the current
implementation.
(
Log in to post comments)