On 04/14/2013 01:46 PM, Stanislav Meduna wrote: > On 14.04.2013 12:08, Gilles Chanteperdrix wrote: > >> PI mutexes are not sufficient to make malloc deterministic. I guess if >> you are looking for a deterministic malloc, you should have a look at TLSF. > > Yup, I know that malloc from glibc is a complicated beast and should > be probably not used at all during hard realtime operation. > > Right now my biggest problem is the possibility of priority inversion. > My time constraints are in the 20 - 50 ms range and I hope the malloc > itself - while not deterministic - is not unbounded / won't go to that > times. I am of course using mlockall and everything. OTOH a priority > inversion case is a sure recipe for missing the deadlines. mlockall does not really help reducing malloc worst case latency. When malloc needs to grow the memory pool it manages, it will request memory to the kernel, using brk or mmap. Since in the Linux kernel, the memory is shared with the filesystem cache, the worst case latency for satisfying such a memory request is the time of a disk flush, so, given the latencies of good old hard disks, it is well in the milliseconds range. mlockall will simply force the kernel to satisfy the whole request ASAP instead of allocating it little by little, upon memory faults, so, may in fact increase the latency of the malloc service. -- Gilles. -- To unsubscribe from this list: send the line "unsubscribe linux-rt-users" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html