[lkml]   [2001]   [May]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Subjectkiobuf setup overhead

I've noticed that alloc_kiovec() calls alloc_kiobuf_bhs(), which...

> int alloc_kiobuf_bhs(struct kiobuf * kiobuf)
> {
> int i;
> for (i = 0; i < KIO_MAX_SECTORS; i++)
> if (!(kiobuf->bh[i] = kmem_cache_alloc(bh_cachep, SLAB_KERNEL))) {
> while (i--) {
> kmem_cache_free(bh_cachep, kiobuf->bh[i]);
> kiobuf->bh[i] = NULL;
> }
> return -ENOMEM;
> }
> return 0;
> }

...where KIO_MAX_SECTORS is currently 1024. This makes a kiobuf quite a
heavy-weight object to allocate and free.

Was this high-overhead initialisation left in because kiobufs shouldn't be
allocated and freed at the drop of a hat in any case?

If not, allocating the kiobuf->bh[i], could be delayed until the number
required is known.

This would be beneficial for direct I/O in the scsi generic driver, which
currently allocates and frees a kiobuf on each read/write.



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

 \ /
  Last update: 2005-03-22 12:52    [W:0.024 / U:0.424 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site