-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
i915kms: leaks memory when i915kms.ko is loaded #155
Comments
Can you dump memory regularly using "vmstat -m" and "vmstat -z" and try to locate the leak? |
I rebooted the computer to load i915kms.ko from drm-fbsd12.0-kmod in order to test. Can you tell me how should I use the output of |
@johalun : Are we sure r349014 has nothing to do with this? @lantw44: Are you using 12.0-release or 12-stable kernel? If 12.0-release, please use a newer kernel. Several known issues have been fixed since 12.0-release. |
I am using 12.0-RELEASE-p6, and I am downloading the source of STABLE now. |
Make sure you put the FreeBSD sources in /usr/src and re-build the drm port from ports. |
@hselasky It might be if we have this problem on stable/12. Hmm, have to think.. It should only wire the pages for linuxkpi >= 50001, right? For 4.16, linuxkpi is not defined.
should be
But how will this affect for example the mellanox drivers etc that don't declare a linuxkpi version? |
I rebooted the system to 12.0-STABLE r349597 today. drm-fbsd12.0-kmod is rebuilt with the new source in /usr/src. Wired memory seems to keep going up, currently at 4191 MiB with 3 hours uptime.
There are a few things in |
@lantw44: Can you try to revert: https://svnweb.freebsd.org/changeset/base/349014 After that rebuild new kernel and drm-fbsd12.0-kmod ? |
I think this is fine, but there is a missing ifdef in the code. |
Hi, Then do some graphics work 2-3 mins. Then CTRL+C the alloctrace.d (attached) and post the output here. |
I let alloctrace.d run for a hour, but it still show nothing. This is FreeBSD 12.0-STABLE r349632 with r349014 reverted. |
It seems that using a different kernel doesn't change things:
|
Try this new alloctrace.txt instead. |
|
Looks good, but can you run this script for some longer time? |
The result of running for 2 hours and 40 minutes.
|
I suggest you to collect backtraces with count for each unique backtrace, in vm_page_wire(). The offender should stay out from such statistics. |
The following script will grab the stacks:
It will collect stacks and exit automatically after 10m. Please paste the output here. |
|
If I interpret the counts correctly, you get a 'leak' of approx 150K wired pages, but the total amount of vm_page_wire() calls seems to be less than 150K by order of magnitude ? |
Maybe he needs to compile a kernel w/o optimisation. Is vm_page_wire() inlined? |
No, vm_page_wire() should be not inlined. But what could happen is vm_page_alloc(VM_ALLOC_WIRED), which directly assigns 1 to wire_count. |
The DTrace script I provided tracks vm_page_alloc() calls with VM_ALLOC_WIRED (0x20) set. However, we were not tracking vm_page_alloc_domain() and vm_page_alloc_domain_after(). Please try again with this script:
|
|
Hi, I see two page leaks in the DRM code. pagecache_write_end() will do a put_page() in Linux (!) Can you try the attached patch? After "make extract patch" cd to the root of the extracted files (work/xxxx) and do: --HPS |
I applied the patch and rebooted the system. Now the system has run for 16 hours, and wired memory usage stays at about 3 GiB, which is similar to the usage of the driver included in base. I will let the system run for longer time. If it can last for 3 days, I think we can say that the problem is resolved. |
Update snapshot of graphics/drm-curent-kmod to include a fix for a memory leak. FreeBSD Graphics issue: #55 FreeBSDDesktop/kms-drm#155 PR: 238925 Reported by: Ting-Wei Lan MFH: 2019Q3 (implicit, drm-drivers blanket) Sponsored by: B3 Init (zeising) git-svn-id: svn+ssh://svn.freebsd.org/ports/head@506353 35697150-7ecd-e111-bb59-0022644237b5
Update snapshot of graphics/drm-fbsd12.0-kmod to include a fix for a memory leak. FreeBSD Graphics issue: #155 FreeBSDDesktop/kms-drm#155 PR: 238925 Reported by: Ting-Wei Lan MFH: 2019Q3 (implicit, drm-drivers blanket) Sponsored by: B3 Init (zeising) git-svn-id: svn+ssh://svn.freebsd.org/ports/head@506354 35697150-7ecd-e111-bb59-0022644237b5
Update snapshot of graphics/drm-curent-kmod to include a fix for a memory leak. FreeBSD Graphics issue: #55 FreeBSDDesktop/kms-drm#155 PR: 238925 Reported by: Ting-Wei Lan MFH: 2019Q3 (implicit, drm-drivers blanket) Sponsored by: B3 Init (zeising)
Update snapshot of graphics/drm-fbsd12.0-kmod to include a fix for a memory leak. FreeBSD Graphics issue: #155 FreeBSDDesktop/kms-drm#155 PR: 238925 Reported by: Ting-Wei Lan MFH: 2019Q3 (implicit, drm-drivers blanket) Sponsored by: B3 Init (zeising)
Merge the latest round of changes to drm-kmod ports. In short, this updats maintainer addresses and adds fixes for a memory leak. Original commit messages below Change maintainer of all drm kmod ports to x11@ Change maintainer of all drm kmod ports to [email protected]. This way, PRs, notice about build breakages from package builds and so on goes to the entire x11@ team, and not just one member. Approved by: jmd (maintainer) graphics/drm-kmod: Update supported versions Update supported versions and ports selection in graphics/drm-kmod. This only affects current. Reviewed by: jmd Sponsored by: B3 Init graphics/drm-current-kmod: Update snapshot Update snapshot of graphics/drm-curent-kmod to include a fix for a memory leak. FreeBSD Graphics issue: #155 FreeBSDDesktop/kms-drm#155 PR: 238925 Reported by: Ting-Wei Lan Sponsored by: B3 Init (zeising) graphics/drm-fbsd12.0-kmod: Update snapshot Update snapshot of graphics/drm-fbsd12.0-kmod to include a fix for a memory leak. FreeBSD Graphics issue: #155 FreeBSDDesktop/kms-drm#155 PR: 238925 Reported by: Ting-Wei Lan Sponsored by: B3 Init (zeising) Approved by: portmgr (drm drivers blanket)
Update snapshot of graphics/drm-curent-kmod to include a fix for a memory leak. FreeBSD Graphics issue: #55 FreeBSDDesktop/kms-drm#155 PR: 238925 Reported by: Ting-Wei Lan MFH: 2019Q3 (implicit, drm-drivers blanket) Sponsored by: B3 Init (zeising) git-svn-id: svn+ssh://svn.freebsd.org/ports/head@506353 35697150-7ecd-e111-bb59-0022644237b5
Update snapshot of graphics/drm-fbsd12.0-kmod to include a fix for a memory leak. FreeBSD Graphics issue: #155 FreeBSDDesktop/kms-drm#155 PR: 238925 Reported by: Ting-Wei Lan MFH: 2019Q3 (implicit, drm-drivers blanket) Sponsored by: B3 Init (zeising) git-svn-id: svn+ssh://svn.freebsd.org/ports/head@506354 35697150-7ecd-e111-bb59-0022644237b5
Now uptime is 3 days and wired memory is still at 3 GiB. I think we can confirm it is fixed. |
Just wanted to say thanks for this- I came in from the internet looking for an answer to this and patched it against my 11.3 machine. I expect to be moving to 12 in a couple of weeks (maybe less) depending on getting some new storage. I have Sandy Bridge and running this i915 patch for the last 4 days and my memory has been stable as well. Not sure if 11.2 is frozen or not but maybe that branch could benefit from this as well. |
I'm on it, looks very straight forward. |
Apply a similar fix as was done to 5.0 and 4.16 by hselasky, to fix a page leak. FreeBSD Graphics issue: drm-kms/#155
Port updated. |
I believe this issue can be closed. All active branches of drm-kmod has had a fix applied. |
Update snapshot of graphics/drm-fbsd11.2-kmod to include a fix for a memory leak. FreeBSD Graphics issue: #155 FreeBSDDesktop/kms-drm#155 PR: 238925 Reported by: Ting-Wei Lan MFH: 2019Q3 (implicit, drm-drivers blanket) Sponsored by: B3 Init (zeising) git-svn-id: svn+ssh://svn.freebsd.org/ports/head@508236 35697150-7ecd-e111-bb59-0022644237b5
Update snapshot of graphics/drm-fbsd11.2-kmod to include a fix for a memory leak. FreeBSD Graphics issue: freebsd#155 FreeBSDDesktop/kms-drm#155 PR: 238925 Reported by: Ting-Wei Lan MFH: 2019Q3 (implicit, drm-drivers blanket) Sponsored by: B3 Init (zeising)
graphics/drm-fbsd11.2-kmod: Update snapshot Update snapshot of graphics/drm-fbsd11.2-kmod to include a fix for a memory leak. FreeBSD Graphics issue: #155 FreeBSDDesktop/kms-drm#155 PR: 238925 Reported by: Ting-Wei Lan Sponsored by: B3 Init (zeising) Approved by: portmgr (implicit, drm-drivers blanket)
Update snapshot of graphics/drm-fbsd11.2-kmod to include a fix for a memory leak. FreeBSD Graphics issue: #155 FreeBSDDesktop/kms-drm#155 PR: 238925 Reported by: Ting-Wei Lan MFH: 2019Q3 (implicit, drm-drivers blanket) Sponsored by: B3 Init (zeising) git-svn-id: svn+ssh://svn.freebsd.org/ports/head@508236 35697150-7ecd-e111-bb59-0022644237b5
@zeising thanks! |
Merge the latest round of changes to drm-kmod ports. In short, this updats maintainer addresses and adds fixes for a memory leak. Original commit messages below Change maintainer of all drm kmod ports to x11@ Change maintainer of all drm kmod ports to [email protected]. This way, PRs, notice about build breakages from package builds and so on goes to the entire x11@ team, and not just one member. Approved by: jmd (maintainer) graphics/drm-kmod: Update supported versions Update supported versions and ports selection in graphics/drm-kmod. This only affects current. Reviewed by: jmd Sponsored by: B3 Init graphics/drm-current-kmod: Update snapshot Update snapshot of graphics/drm-curent-kmod to include a fix for a memory leak. FreeBSD Graphics issue: #155 FreeBSDDesktop/kms-drm#155 PR: 238925 Reported by: Ting-Wei Lan Sponsored by: B3 Init (zeising) graphics/drm-fbsd12.0-kmod: Update snapshot Update snapshot of graphics/drm-fbsd12.0-kmod to include a fix for a memory leak. FreeBSD Graphics issue: #155 FreeBSDDesktop/kms-drm#155 PR: 238925 Reported by: Ting-Wei Lan Sponsored by: B3 Init (zeising) Approved by: portmgr (drm drivers blanket)
graphics/drm-fbsd11.2-kmod: Update snapshot Update snapshot of graphics/drm-fbsd11.2-kmod to include a fix for a memory leak. FreeBSD Graphics issue: #155 FreeBSDDesktop/kms-drm#155 PR: 238925 Reported by: Ting-Wei Lan Sponsored by: B3 Init (zeising) Approved by: portmgr (implicit, drm-drivers blanket)
From FreeBSD pr 238925
My desktop computer has 16 GiB RAM, but it seems that drm-fbsd12.0-kmod keeps leaking memory, using up all memory in one day and forcing me to reboot. This computer uses Intel i5-650 CPU and its integrated Intel Ironlake graphics. The operating system is FreeBSD 12.0 with GNOME desktop environment.
If I remember correctly, the problem has existed since the introduction of drm-fbsd12.0-kmod port. Here are a few test results I found a few days ago. The version of drm-fbsd12.0-kmod is 4.16.g20190624.
When the system was just booted, wired memory was below 3 GiB.
After the system had run for 12 hours, wired memory became 12 GiB. The desktop was still responsive, but the usage of swap was increasing.
After the system had run for 15 hours, wired memory become 15 GiB. The desktop was non-responsive, and it was slow to run any command from an SSH login shell. Ctrl-T showed that most of time are spent on swapping. Even Ctrl-C took several seconds to respond.
After I managed to terminate Xorg and bring down the desktop environment, the shell became responsive again. However, wired memory usage was still 14 GiB. It seemed that there was no way to reclaim the memory so I had to reboot it.
This kind of memory leak only happens when i915kms.ko from drm-fbsd12.0-kmod is used. It doesn't happen if i915kms.ko from base is used. If I use i915kms.ko from base, wired memory usually stays below 3 GiB, and the system can last more than one month without the need to reboot.
The text was updated successfully, but these errors were encountered: