Re: Memory allocation in kernel -- what to use in which situation? What is the best for page-sized allocations?

2011-10-02 Thread Alan Cox
On Sun, Oct 2, 2011 at 1:21 PM, wrote: > 2011/10/2 Lev Serebryakov : > > Hello, Freebsd-hackers. > > > > Here are several memory-allocation mechanisms in the kernel. The two > > I'm aware of is MALLOC_DEFINE()/malloc()/free() and uma_* (zone(9)). > > > > As far as I understand, malloc() is gene

Re: Memory allocation in kernel -- what to use in which situation? What is the best for page-sized allocations?

2011-10-02 Thread mdf
2011/10/2 Lev Serebryakov : > Hello, Freebsd-hackers. > >  Here are several memory-allocation mechanisms in the kernel. The two > I'm aware of is MALLOC_DEFINE()/malloc()/free() and uma_* (zone(9)). > >  As far as I understand, malloc() is general-purpose, but it has > fixed "transaction cost" (in

Re: Memory allocation in kernel -- what to use in which situation? What is the best for page-sized allocations?

2011-10-02 Thread Davide Italiano
On Sun, Oct 2, 2011 at 4:37 PM, Lev Serebryakov wrote: > Hello, Davide. > You wrote 2 октября 2011 г., 18:00:26: > >>>  BTW, I/O is often require big buffers, up to MAXPHYS (128KiB for >>>  now), do you mean, that any allocation of such memory has >>>  considerable performance penalties, especiall

Re: Memory allocation in kernel -- what to use in which situation? What is the best for page-sized allocations?

2011-10-02 Thread Lev Serebryakov
Hello, Davide. You wrote 2 октября 2011 г., 18:00:26: >>  BTW, I/O is often require big buffers, up to MAXPHYS (128KiB for >>  now), do you mean, that any allocation of such memory has >>  considerable performance penalties, especially on multi-core and >>  multi-CPU systems? >> > In fact, the mai

Re: Memory allocation in kernel -- what to use in which situation? What is the best for page-sized allocations?

2011-10-02 Thread Davide Italiano
2011/10/2 Lev Serebryakov : > Hello, Davide. > You wrote 2 октября 2011 г., 16:57:48: > >>>   But what if I need to allocate a lot (say, 16K-32K) of page-sized >>> blocks? Not in one chunk, for sure, but in lifetime of my kernel >>> module. Which allocator should I use? It seems, the best one will

Re: Memory allocation in kernel -- what to use in which situation? What is the best for page-sized allocations?

2011-10-02 Thread Lev Serebryakov
Hello, Davide. You wrote 2 октября 2011 г., 16:57:48: >>   But what if I need to allocate a lot (say, 16K-32K) of page-sized >> blocks? Not in one chunk, for sure, but in lifetime of my kernel >> module. Which allocator should I use? It seems, the best one will be >> very low-level only-page-sized

Re: Memory allocation in kernel -- what to use in which situation? What is the best for page-sized allocations?

2011-10-02 Thread Davide Italiano
2011/10/2 Lev Serebryakov : > Hello, Freebsd-hackers. > >  Here are several memory-allocation mechanisms in the kernel. The two > I'm aware of is MALLOC_DEFINE()/malloc()/free() and uma_* (zone(9)). > >  As far as I understand, malloc() is general-purpose, but it has > fixed "transaction cost" (in

Re: Memory allocation in kernel -- what to use in which situation? What is the best for page-sized allocations?

2011-10-02 Thread Kostik Belousov
On Sun, Oct 02, 2011 at 04:21:09PM +0400, Lev Serebryakov wrote: > Hello, Freebsd-hackers. > > Here are several memory-allocation mechanisms in the kernel. The two > I'm aware of is MALLOC_DEFINE()/malloc()/free() and uma_* (zone(9)). > > As far as I understand, malloc() is general-purpose, b

Memory allocation in kernel -- what to use in which situation? What is the best for page-sized allocations?

2011-10-02 Thread Lev Serebryakov
Hello, Freebsd-hackers. Here are several memory-allocation mechanisms in the kernel. The two I'm aware of is MALLOC_DEFINE()/malloc()/free() and uma_* (zone(9)). As far as I understand, malloc() is general-purpose, but it has fixed "transaction cost" (in term of memory consumption) for each b