On Mon, Nov 3, 2008 at 5:34 PM, Andrey Kuzmin <[EMAIL PROTECTED]> wrote:

>> o 03-kmem_alloc.patch
>>
>> This patch changes calls to kmem_alloc() to kmem_zalloc(). I believe
>> it is cleaner (the buffers coming from kmem_alloc() are deterministic)
>> that way and in one place it helps simplifying the code somewhat (see
>> stmf_sbd.c:867)
>
> zalloc has its overhead, so there should be some reason to zero-fill
> the structure before using it. If there's some non-trivial
> initialization, kmem_cache would be more suitable.
>

Indeed, kmem_zalloc() has an overhead of added bzero(). However, on
modern CPU bzero() should be pretty fast (I'd say if it isn't, it is,
probably, a bug).
I think the only case that warrants use of _non_ zero-filled memory is
that of other kind of initialization (like bcopy(), copyin(), etc),
that follows the allocation right away.
Otherwise watch for random data getting used somewhere down the road.

-- 
Regards,
        Cyril
_______________________________________________
storage-discuss mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/storage-discuss

Reply via email to