request_firmware API exhaust memory

Tomas Winkler
2010-04-19T12:20:37Z

Lately we've been developing a device that rather more extensively
used request_firmware API in load and also using pm_notifiers to load
firmware. In some stress testing the usage will exhaust the system
memory. First we suspected there is a memory leak in the
firwmare_class but eventually what is that udevd piles up it takes
time to collect the process. We loose ~ 500K for each
request/release_firmware iteration.
After the stress the process table will will look something like shown below,

If someone with more insight can point out what part of this firmware
load has to be fixed and what is the best strategy request_firmware
API used extensively. I believe currently only Orinoco driver uses
pm_notifies to load firmware before S3/S4 but if there are more
drivers like that it might actually create a real problem during
suspend on some small systems.

root 514 0.0 0.0 15480 1116 ? S<s Apr01 0:01 /sbin/udevd -d
root 28989 0.0 0.0 15476 968 ? S< 14:07 0:00 /sbin/udevd -d
root 28995 0.0 0.0 15476 976 ? S< 14:07 0:00 /sbin/udevd -d
root 31616 0.0 0.0 15476 916 ? S< 14:49 0:00 /sbin/udevd -d
root 31622 0.0 0.0 15476 888 ? S< 14:49 0:00 /sbin/udevd -d
root 31627 0.0 0.0 15476 916 ? S< 14:49 0:00 /sbin/udevd -d
root 31633 0.0 0.0 15476 888 ? S< 14:49 0:00 /sbin/udevd -d
root 31638 0.0 0.0 15476 916 ? S< 14:49 0:00 /sbin/udevd -d
root 31644 0.0 0.0 15476 888 ? S< 14:49 0:00 /sbin/udevd -d
root 31649 0.0 0.0 15476 916 ? S< 14:49 0:00 /sbin/udevd -d
root 31655 0.0 0.0 15476 888 ? S< 14:49 0:00 /sbin/udevd -d
root 31660 0.0 0.0 15476 916 ? S< 14:49 0:00 /sbin/udevd -d
root 31666 0.0 0.0 15476 888 ? S< 14:49 0:00 /sbin/udevd -d
root 31671 0.0 0.0 15476 916 ? S< 14:49 0:00 /sbin/udevd -d
root 31677 0.0 0.0 15476 888 ? S< 14:49 0:00 /sbin/udevd -d
root 31682 0.0 0.0 15476 916 ? S< 14:49 0:00 /sbin/udevd -d
root 31688 0.0 0.0 15476 888 ? S< 14:49 0:00 /sbin/udevd -d
root 31693 0.0 0.0 15476 916 ? S< 14:49 0:00 /sbin/udevd -d
root 31699 0.0 0.0 15476 888 ? S< 14:49 0:00 /sbin/udevd -d
root 31704 0.0 0.0 15476 916 ? S< 14:49 0:00 /sbin/udevd -d
root 31710 0.0 0.0 15476 888 ? S< 14:49 0:00 /sbin/udevd -d
root 31715 0.0 0.0 15476 916 ? S< 14:49 0:00 /sbin/udevd -d
root 31721 0.0 0.0 15476 888 ? S< 14:49 0:00 /sbin/udevd -d
root 31726 0.0 0.0 15476 916 ? S< 14:49 0:00 /sbin/udevd -d
root 31732 0.0 0.0 15476 888 ? S< 14:49 0:00 /sbin/udevd -d
root 31737 0.0 0.0 15476 916 ? S< 14:49 0:00 /sbin/udevd -d
root 31743 0.0 0.0 15476 888 ? S< 14:49 0:00 /sbin/udevd -d
root 31748 0.0 0.0 15476 916 ? S< 14:49 0:00 /sbin/udevd -d
root 31754 0.0 0.0 15476 888 ? S< 14:49 0:00 /sbin/udevd -d
root 31759 0.0 0.0 15476 916 ? S< 14:49 0:00 /sbin/udevd -d
root 31765 0.0 0.0 15476 888 ? S< 14:49 0:00 /sbin/udevd -d
root 31770 0.0 0.0 15476 916 ? S< 14:49 0:00 /sbin/udevd -d
root 31776 0.0 0.0 15476 888 ? S< 14:49 0:00 /sbin/udevd -d
root 31781 0.0 0.0 15476 916 ? S< 14:49 0:00 /sbin/udevd -d
root 31787 0.0 0.0 15476 888 ? S< 14:49 0:00 /sbin/udevd -d
root 31792 0.0 0.0 15476 916 ? S< 14:49 0:00 /sbin/udevd -d
root 31798 0.0 0.0 15476 888 ? S< 14:49 0:00 /sbin/udevd -d
root 31803 0.0 0.0 15476 916 ? S< 14:49 0:00 /sbin/udevd -d
root 31809 0.0 0.0 15476 888 ? S< 14:49 0:00 /sbin/udevd -d
root 31814 0.0 0.0 15476 916 ? S< 14:49 0:00 /sbin/udevd -d
root 31820 0.0 0.0 15476 888 ? S< 14:49 0:00 /sbin/udevd -d
root 31825 0.0 0.0 15476 916 ? S< 14:49 0:00 /sbin/udevd -d
root 31831 0.0 0.0 15476 888 ? S< 14:49 0:00 /sbin/udevd -d
root 31836 0.0 0.0 15476 916 ? S< 14:49 0:00 /sbin/udevd -d
root 31842 0.0 0.0 15476 888 ? S< 14:49 0:00 /sbin/udevd -d
root 31847 0.0 0.0 15476 916 ? S< 14:49 0:00 /sbin/udevd -d
root 31853 0.0 0.0 15476 888 ? S< 14:49 0:00 /sbin/udevd -d