[etherlab-users] e1000 memory leaks/random freeze

Luca Barisani lcbarisa at gmail.com
Mon Jun 10 15:14:48 CEST 2019

Hi all,

I'm working on a realtime control system driving a group of motors, my

- RTAI 5.1 patched linux kernel 4.9.80 smp preempt
- Vortex86DX3 SoC (2 cores @1 GHz)
- e1000 (82541GI chipset)
- etherlab drivers from github.com/ribalda/ethercat/tree/master

The main motion c control loop runs at 1Khz inside a RTAI hard realtime
using the RTDM interface via libethercat_rtdm to exchange data.
I came upon two problems:

* After loading at boot, ethercat module ec_e1000 start eating up more and
more kernel
memory (object kmalloc-192, as seen from slabtop) until the whole 1G
for the kernel is filled up and oom killer process is triggered.
The function that seemed responsible for this behavior, e1000_clean_rx_irq,
be found in devices/e1000/e1000_main-4.9-ethercat.c, around line 4515.
In particular the struct sk_buff *skb gets multiple allocations and is
released. I added the lines:

if (skb)

just before "next_desc:" label and this seems to have solved the issue.

** When the control loop runs inside a soft realtime thread (using
rt_make_soft_real_time() from RTAI api, essentially a linux high priority
there are no problems but the latencies are not entirely satisfactory, so
became necessary to call rt_make_hard_real_time() instead to use the full
hard realtime
RTAI capabilities, but a new problem came up: the machine started freezing
sometimes after few seconds, sometimes after few hours.
I found that it always freeze during the netdev_alloc_frag call @line 2136

Unfortunately my knowledge of the driver is too limited to dig deeper into
the cause
of the problem, so I'm asking if some of you may have any suggestions.

Best regards, Luca
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.etherlab.org/pipermail/etherlab-users/attachments/20190610/8196cb1e/attachment-0002.htm>

More information about the Etherlab-users mailing list