fix out of memory handling
The original code tried to limit the memory to 800M, which is wrong
because my EEE only has 1G or memory.
Also it tested how much memory by reading a proc file which was slow and
the proc file still said you were using too much memory after you freed
a bunch of stuff. It was terribly bad.
The new way basically says you can use 50M for sm_states. Of course smatch
uses a lot of other memory besides just the stuff for sm_states so the
actual max memory used is almost 10 times that amount. But that's Ok.
The new way of checking for OOM is much faster so we can do it more often.
Checking in merge_slist() is a huge improvement.
There are 6 functions in the kernel where smatch bails because they are
too hairy. Those functions used to drag my system to a halt and then get
killed by the kernel's OOM killer on my system. So this seems to work
great.
Signed-off-by: Dan Carpenter <error27@gmail.com>