Backport KSM from Linux 3.6.8