mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* __getname vs kmalloc
@ 2006-01-04  6:32 Josef Sipek
  2006-01-04 10:19 ` Trond Myklebust
  0 siblings, 1 reply; 3+ messages in thread
From: Josef Sipek @ 2006-01-04  6:32 UTC (permalink / raw)
  To: linux-kernel

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.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: __getname vs kmalloc
  2006-01-04  6:32 __getname vs kmalloc Josef Sipek
@ 2006-01-04 10:19 ` Trond Myklebust
  2006-01-04 10:35   ` Josef Sipek
  0 siblings, 1 reply; 3+ messages in thread
From: Trond Myklebust @ 2006-01-04 10:19 UTC (permalink / raw)
  To: Josef Sipek; +Cc: linux-kernel

On Wed, 2006-01-04 at 01:32 -0500, Josef Sipek wrote:
> 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.

> 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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: __getname vs kmalloc
  2006-01-04 10:19 ` Trond Myklebust
@ 2006-01-04 10:35   ` Josef Sipek
  0 siblings, 0 replies; 3+ messages in thread
From: Josef Sipek @ 2006-01-04 10:35 UTC (permalink / raw)
  To: Trond Myklebust; +Cc: linux-kernel

On Wed, Jan 04, 2006 at 11:19:29AM +0100, Trond Myklebust wrote:
> On Wed, 2006-01-04 at 01:32 -0500, Josef Sipek wrote:
> > 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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-01-04 10:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-01-04  6:32 __getname vs kmalloc Josef Sipek
2006-01-04 10:19 ` Trond Myklebust
2006-01-04 10:35   ` Josef Sipek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®