btrfs icon indicating copy to clipboard operation
btrfs copied to clipboard

Memory leak virtual address space huge

Open sumariva opened this issue 1 year ago • 2 comments

I opening this issue as I suspect that the driver may be leaking memory. I could only realize for sure if you instruct me, how to compile the code with some file logging support. If the driver could write down the PID or some other details. I posting the images about what I think it is. The system is uptime for 8 days. Just suspended it yesterday, when I flipped the screen.

btrfs-uptime One week of hard work, with crypto, some games, Internet access.

btrfs-driver-i-guess I am not sure if it is the driver. If the driver could write down or have some place to inquire the process id it is running on...

btrfs-virtual-memory Memory space using about 20GiB. Noticing system degradation due to large disk swapping on SSD. I will need to reboot shortly.

As I stated, I could experiment with the new driver releases. I have been using this machine all working days, until April 15th.

sumariva avatar Apr 01 '24 17:04 sumariva

If you can attach a kernel debugger and run !poolused in windbg, it breaks down the memory usage by driver. The Btrfs tag is MHBt.

Paged pool: 5.6 GB Non-paged pool: 5.4 GB

These are both higher than I'd expect. If there was a memory leak in the driver, I'd expect one or other of them to be high.

Also, are you using compression? I've not fully audited the zlib, lzo, and zstd compression libraries we're using.

maharmstone avatar Apr 01 '24 19:04 maharmstone

Yes, I am using a lot of zstd compression on directories that store the databases for the crypto currencies. Severe random file access for read and writes at tails of database. I also sent a copy of monero database, 65GiB in compact mode, so all these was read from btrfs with zstd and written compressed to a NTFS with LZMA. The compressed package was sent through network and reached friend's computer. Looks like in perfect state.

Just to mention, the LZMA compression, which was made by 7-zip tool, was very superior to zstd. If those compressions are things available to add on on btrfs, this one is a very good one!

Below an sample, after opening 2 crypto clients to sync for a few minutes:

!poolused 1 MHBt
....
 Sorting by Tag

                            NonPaged                                         Paged
 Tag       Allocs       Frees      Diff         Used       Allocs       Frees      Diff         Used

 MHBt      328018      184207    143811     21511808      3458681     3093772    364909     54884768	UNKNOWN pooltag 'MHBt', please update pooltag.txt

TOTAL      328018      184207    143811     21511808      3458681     3093772    364909     54884768
lkd> !poolused 1 MHBt
....
 Sorting by Tag

                            NonPaged                                         Paged
 Tag       Allocs       Frees      Diff         Used       Allocs       Frees      Diff         Used

 MHBt      705634      430458    275176     39005664      6667277     5798470    868807    152818544	UNKNOWN pooltag 'MHBt', please update pooltag.txt

TOTAL      705634      430458    275176     39005664      6667277     5798470    868807    152818544
lkd> !poolused 1 MHBt
....
 Sorting by Tag

                            NonPaged                                         Paged
 Tag       Allocs       Frees      Diff         Used       Allocs       Frees      Diff         Used

 MHBt      918419      566558    351861     48693488      8952243     8195182    757061    102984720	UNKNOWN pooltag 'MHBt', please update pooltag.txt

TOTAL      918419      566558    351861     48693488      8952243     8195182    757061    102984720
lkd> !poolused 1 MHBt
....
 Sorting by Tag

                            NonPaged                                         Paged
 Tag       Allocs       Frees      Diff         Used       Allocs       Frees      Diff         Used

 MHBt     1644437     1085322    559115     71332736     16995976    15790103   1205873    165387680	UNKNOWN pooltag 'MHBt', please update pooltag.txt

TOTAL     1644437     1085322    559115     71332736     16995976    15790103   1205873    165387680

Looks like I need to edit this pooltag.txt and create an entry for your driver.

sumariva avatar Apr 01 '24 20:04 sumariva