On Wed 29-11-17 22:28:08, Tetsuo Handa wrote: > register_shrinker() might return -ENOMEM error since Linux 3.12. > > Signed-off-by: Tetsuo Handa <penguin-kernel@xxxxxxxxxxxxxxxxxxx> Fixes: 1d3d4437eae1 ("vmscan: per-node deferred work") > Cc: Izik Eidus <izik.eidus@xxxxxxxxxxxxxxxxxx> > Cc: Avi Kivity <avi@xxxxxxxxxxxx> > Cc: Michal Hocko <mhocko@xxxxxxxx> >From my very limited understanding of this code it looks correct to me. FWIW Reviewed-by: 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 > -- Michal Hocko SUSE Labs