Skip to contentSkip to conversation

__getname vs kmalloc

DISCUSSION Josef Sipek 2 participants 3 messages Jan 4, 2006

lore
Share & tools
lore
#0 lore raw

Which is the prefered method of allocating memory __getname or kmalloc?

I looked at the source, and it appears to be used by 9p, smbfs, parts of VFS. In total there are only 10 calls to it.

Thanks,

Jeff Sipek.

#1 lore raw
Quoted 1 line · Josef Sipek

Which is the prefered method of allocating memory __getname or kmalloc?

Depends entirely on the purpose. __getname uses the "names_cache" slab and allocates PATH_MAX sized chunks. It is mainly supposed to be used for temporary storage of an entire path.

Quoted 2 lines

I looked at the source, and it appears to be used by 9p, smbfs, parts of VFS. In total there are only 10 calls to it.

Most callers use getname(), which also does the string length sanity checks and then copies the path from userland memory.

Cheers,
Trond

#2 lore raw
Quoted 9 lines · Trond Myklebust
Quoted 1 line · Josef Sipek

Which is the prefered method of allocating memory __getname or kmalloc?

Depends entirely on the purpose. __getname uses the "names_cache" slab and allocates PATH_MAX sized chunks. It is mainly supposed to be used for temporary storage of an entire path.

Most callers use getname(), which also does the string length sanity checks and then copies the path from userland memory.

Ah, so since I am working with path components that'll get most of the time passed to lookup_one_len & friends, kmalloc is the better way to get memory, correct?

Thanks,
Jeff Sipek