netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* how expensive are mallocs?
@ 2009-11-24 17:57 Andrew Grover
  2009-11-25 23:18 ` David Miller
  2009-11-26 22:25 ` Andi Kleen
  0 siblings, 2 replies; 3+ messages in thread
From: Andrew Grover @ 2009-11-24 17:57 UTC (permalink / raw)
  To: netdev

How much effort generally makes sense to avoid mallocs? For example,
rds has a function that does a kmalloc for an array of scatterlist
entries, which is freed at the bottom of the function. We couldn't
allocate off the stack in all cases (too big), but we could allocate
an array of say 8 scatterlists, and use it if that's big enough,
falling back to kmalloc if it's not.

Is this a good idea?

Also, RDS has its own per-cpu page remainder allocator (see
net/rds/page.c) for kernel send buffers. Would cutting this code and
just using kmalloc be recommended? Doesn't SL?B already do per-cpu
pools?

Does this stuff even matter enough to rise above the noise in benchmarks?

Thanks -- Regards -- Andy

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

end of thread, other threads:[~2009-11-26 22:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-24 17:57 how expensive are mallocs? Andrew Grover
2009-11-25 23:18 ` David Miller
2009-11-26 22:25 ` Andi Kleen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).