While going through an archive of content I made during the transition to some new hardware I found some steps in FreeBSD which may be useful to others in a similar situation. This was a while back and during that time finding a balance between a desktop environment, ZFS, and building up a development environment created some interesting outcomes. ZFS has many attractive features including it's ARC cache. Files will get cached on the system for faster access and allocates RAM while doing so. These settings can be adjusted and between releases 11 and 12 of FreeBSD ZFS received a major tune-up in this department. Back in the days of 11 it was common that between ZFS and my integrated i915 gpu they would start to fight for RAM. The culprit was the graphics card mainly and it was eating up RAM very quickly. My options were to reinstall everything with UFS instead and just deal with it, tear down my desktop and run headless, or actually try and sort out the i915 issue. I chose the latter because my development relied heavily on benchmarking the results while running on top of ZFS. Just searching around on Github I found a similar report and some good results for 12 but was not available for 11. I decided to patch this fix into 11 and test it out myself.
Drop A GEM On 'Em
GEM stands for Graphics Execution Manager and is a generic DRM (Direct Rendering Module) memory management framework. That is the description in the drm-memory man page. Many of the user land drivers in BSD actually track changes in Linux graphics drivers. There are places where they diverge and in this case that is where the issue was located.
While flipping pages and marking them as dirty what seemed to be missing was the correct memory management functions. This was easy enough to see in the patch for 12 so I began editing the code brought down from the FreeBSD ports collection. I just had to make sure it was added in there like so:
In the FreeBSD ports system most of the files being compiled can be found in the "work" folder. Even if you edit them recompiling will generally pull down the latest port files and overwrite them so what you really want is to patch the file. This can be accomplished with the "diff" command:
If you just "make" after building everything like I did here the compiler is well within reason to believe nothing needs to get built. Just be sure to "make clean extract patch" and everything should build. Running the command "make install" will deploy the code after building:
Afterwards I reported my results and everything ran much better. This kept me rolling until it was time to upgrade.
Top comments (0)