memory.lua: Use lib.{readfile,writefile} to simplify {get,set}_hugepages.