* kiobuf setup overhead
@ 2001-05-09 9:08 Eric Barton
0 siblings, 0 replies; only message in thread
From: Eric Barton @ 2001-05-09 9:08 UTC (permalink / raw)
To: linux-kernel
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.
--
Cheers,
Eric
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2001-05-09 9:07 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-05-09 9:08 kiobuf setup overhead Eric Barton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox