UBC failcnt reset
One of the frequently asked question is How do I reset failcnt in /proc/user_beancounters? While it's not suggested, it is possible.
Contents
What is failcnt?
There are a number of resource limits (called User Beancounters, or UBC for short) set for a VE. If one of those resources hit its limit, the appropriate fail counter (last column of /proc/user_beancounters
) increases. See Resource shortage for more info.
How to clear failcnt?
You do not need to, and this would be an incorrect thing to do.
There can be many application who reads /proc/user_beancounters
, and thus if you will reset it you gonna have problems with those other apps. Consider what happens if you will reset you sent/received packets/bytes statistics on the network interface — programs which reads will be screwed up.
So, the proper procedure of checking failcnt is not to check whether it is zero or not, but to check whether it is increased since the previous readout. In other words, check the difference, not the absolute value. It is easy to write a simple script to do just that.
OK, I understand, but I still want to clear failcnt!
OK, you can do so by restarting your VE. Since fail counters are for VE lifetime, they will be cleared after VE stop.
The problem here is tcp time wait buckets can still there after a VE is stopped. You can check that by seeing the held
column for kmemsize
parameter. If it is not zero, that means you have to wait about 5 minutes in order to time wait buckets to expire, and the corresponding beancounter to be uncharged.
If you still see failcnt not reset to 0 after more than 5 minutes after VE is stopped, your kernel was likely compiled with CONFIG_UBC_KEEP_UNUSED=y, and in that case you'll have to switch off this option if you want to reset beancounters when VE is restarted.
If you're sure your kernel was NOT compiled with the above option and it's not resetting failcnt after 5 minutes, it means there is a bug in UBC code. Please file a detailed bug report to bugzilla.openvz.org