SQM memory requirements? Getting "tc: page allocation failure" on 32MB RAM device

Hi, does anyone know router RAM requirements for using the SQM package for quality of service?

I tried setting up SQM on a 32 MB RAM device (a TP-LINK TL-WR1043ND router). On this device, when SQM starts, I get several page allocation failure warnings from tc.

Tue Feb  5 10:12:53 2019 user.notice SQM: Starting SQM script: piece_of_cake.qos on eth0.2, in: 133632 Kbps, out: 17510 Kbps
Tue Feb  5 10:12:54 2019 kern.warn kernel: [355735.088469] tc: page allocation failure: order:8, mode:0x240c0c0(GFP_KERNEL|__GFP_COMP|__GFP_ZERO)
Tue Feb  5 10:12:54 2019 kern.warn kernel: [355735.097705] CPU: 0 PID: 7844 Comm: tc Not tainted 4.9.120 #0
Tue Feb  5 10:12:54 2019 kern.warn kernel: [355735.103510] Stack : 80497672 00000030 00000000 00000001 00000000 00000000 00000000 00000000
Tue Feb  5 10:12:54 2019 kern.warn kernel: [355735.112061]         00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
Tue Feb  5 10:12:54 2019 kern.warn kernel: [355735.120625]         00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
Tue Feb  5 10:12:54 2019 kern.warn kernel: [355735.129188]         00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
Tue Feb  5 10:12:54 2019 kern.warn kernel: [355735.137750]         00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
Tue Feb  5 10:12:54 2019 kern.warn kernel: [355735.146313]         ...
Tue Feb  5 10:12:54 2019 kern.warn kernel: [355735.148869] Call Trace:
...
Tue Feb  5 10:12:57 2019 user.notice SQM: piece_of_cake.qos was started on eth0.2 successfully

SQM is still working somewhat, as tests with the DSLReports site show substantial improvement in bufferbloat.

However, are there any minimum RAM requirements for SQM or a way to configure tc to try to use less RAM? Or just use devices with more memory?

I also tested with an Ubuquity EdgeRouterX (which has way more RAM) and don't get any similar memory warnings (not surprisingly).

https://openwrt.org/supported_devices/432_warning

Usability issues

Insufficient RAM for stable operation

  • 32 MB can work for minimal router/AP functions, but may repeatedly “crash”, depending on your hardware and use case

Running SQM is past "minimal router/AP functions".

Further, if you've only got 32 MB it looks like you're running a v1 device and its 400 MHz, single-core, MIPS-based SoC and single Ethernet interface probably couldn't manage much more than 50-100 mbps if memory exhaustion wasn't an issue. (A 700-800 MHz, MIPS-based SoC with two Ethernet interfaces caps out at somewhere around 200 Mbps.)

1 Like

That's not enough CPU to NAT and SQM 133 Mbps. For that ISP speed you need better hardware.

EdgeRouter X is 800 MHz dual core vs. 400 MHz single in the 1043v1 -- approximately 4x the performance. It's a good unit for your application.

I do not, but I do know that cake can be configured with a maximum memory parameter:
Here is what man tc-cake has to say on that matter:

OTHER PARAMETERS
       memlimit LIMIT
            Limit the memory consumed by Cake to LIMIT bytes. Note  that  this
       does not translate directly to queue size (so do not size this based on
       bandwidth delay  product  considerations,  but  rather  on  worst  case
       acceptable  memory  consumption), as there is some overhead in the data
       structures containing the packets, especially for small packets.

            By default, the limit is calculated based on the bandwidth and RTT
       settings.

You could use the advanced option strings to pass this to cake. I note that both HTB and fq_codel have similar toggles.
Now whether it is sensible to still carry 32 MB devices into the present with relative modern bandwidth is a different can of worms that I do not want to open here.

P.S.: tc -s qdisc will make cake print its current memory consumption (as well as max size IIRC)

1 Like

Hi, thanks very much for the tip on the memlimit parameter. I set that and I do see tc reporting that (lower) amount of memory used in "tc -s qdisc". So it is having an effect, but I still see the tc page allocation failure log messages.

Thanks to others for their replies also. I was testing with a TP-LINK 1043ND v1 device and with a DSL connection at 5 MBit/sec down and 0.5 up, so a small connection. The example above was trying the same type of device elsewhere. I've deployed so many of these 1043NDs as VLAN-enabled routers over many years, such good hardware for their day. It would have been nice to use SQM with them on DSL connections, which are still pretty common. Finally they are hitting their limits...

To report on testing the EdgeRouterX on a 100/100 Mbit/sec fiber connection with SQM, it was at about 30% CPU usage with a full rate speed test going on, so a definite good fit for that bandwidth. It costs about $70 so a nice price.

1 Like