kiobuf setup overhead
I've noticed that alloc_kiovec() calls alloc_kiobuf_bhs(), which...
Quoted 14 lines
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.
Signature · 2 lines
Cheers,
Eric