register_shrinker() might return -ENOMEM error since Linux 3.12. Signed-off-by: Tetsuo Handa <penguin-kernel@xxxxxxxxxxxxxxxxxxx> Cc: Izik Eidus <izik.eidus@xxxxxxxxxxxxxxxxxx> Cc: Avi Kivity <avi@xxxxxxxxxxxx> Cc: Michal Hocko <mhocko@xxxxxxxx> --- arch/x86/kvm/mmu.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index e5e66e5..432da2e 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch/x86/kvm/mmu.c @@ -5482,7 +5482,10 @@ int kvm_mmu_module_init(void) if (percpu_counter_init(&kvm_total_used_mmu_pages, 0, GFP_KERNEL)) goto nomem; - register_shrinker(&mmu_shrinker); + if (register_shrinker(&mmu_shrinker)) { + percpu_counter_destroy(&kvm_total_used_mmu_pages); + goto nomem; + } return 0; -- 1.8.3.1