openzfsonwindows / openzfs

OpenZFS on Linux and FreeBSD
https://openzfs.github.io/openzfs-docs
Other
455 stars 16 forks source link

vflush: Print reclaim statistics #323

Closed EchterAgo closed 10 months ago

EchterAgo commented 10 months ago

This shows how many reclaims have been processed in thousand increments and also how many reclaims are processed per second.

EchterAgo commented 10 months ago

Some more testing revealed that last_stats_time_delta can be zero, maybe timer granularity? ChatGPT tells me the timer granularity of KeQueryTickCount is around 838 nanoseconds, doing 1000 reclaims should have taken longer than that, shouldn't it? I further optimized reclaim, maybe we are too fast now :D

EchterAgo commented 10 months ago

I'm pretty sure ChatGPT is wrong about the granularity of KeQueryTickCount and yes, it does look like my last change sped up the loop a lot, now it is at ~64000 reclaims per second, where it was at hundreds and lower before, the time required grew exponentially with the number of nodes because we restarted the loop.

EchterAgo commented 10 months ago

Yea, so the gethrtime value updates only every 15.625 milliseconds, if we do 1000 iterations in that time we get a divide by zero.

EchterAgo commented 10 months ago

We should probably switch gethrtime to KeQueryPerformanceCounter

EchterAgo commented 10 months ago

Ok, rebased on top of the gethrtime change and added a MAX to prevent divide by zero.

EchterAgo commented 10 months ago

We can also skip this commit, I just used it to measure #328 before and after.

EchterAgo commented 10 months ago

Closing because merged as part of #328