[Cake] cake memory consumption

Sebastian Gottschall s.gottschall at newmedia-net.de
Tue Sep 17 05:55:08 EDT 2019


Am 17.09.2019 um 11:21 schrieb Jonathan Morton:
>> On 17 Sep, 2019, at 8:31 am, Sebastian Gottschall <s.gottschall at newmedia-net.de> wrote:
>>
>> according to the output there is a flaw/bug in the memory limit calculation
>> cake_reconfigure     may set buffer_limit to  ~0 if no rate is set.
>>
>> the following line "min(buffer_limit, max(sch->limit * psched_mtu(qdisc_dec(sch), q->buffer_config_limit))" doesnt make it better since buffer_config_limit is not configured
>> so we got a possible memory overuse here.
> In C, ~0 means "as near to infinity as an unsigned integer can get", or effectively 4GB.  That construct is used to get that part of the calculation out of the way, so that it has no effect in the following nested max() and min() macros.
>
> What actually happens here is that the "packet limit" property of the interface becomes governing, and is recalculated in terms of a byte count by multiplying it by the MTU.  So the limit configured for each Cake instance in your particular case is 15MB, corresponding to 10,000 packets:
>
>>   memory used: 0b of 15140Kb
> With so many Cake instances loaded (very much *not* the normal configuration!) and only 128MB total RAM, 15MB is obviously too high a limit to be completely safe - even though Cake's AQM action will keep the *average* queue depth well below that limit.
>
> The correct fix here is not to change the code, but to use the memlimit parameter to override the default.  These unusual configurations, where the default logic breaks, are precisely why it was added.
okay. so i will handle it custom in my code depending on the device memory
>
>   - Jonathan Morton
>
>


More information about the Cake mailing list