diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 28cbacae4e5161d0682356fbd3260fca27ff1bcc..ee595ef30470e8060efb24150380c5c69bb74f2d 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -1774,6 +1774,8 @@ static int preferred_group_nid(struct task_struct *p, int nid)
 			}
 		}
 		/* Next round, evaluate the nodes within max_group. */
+		if (!max_faults)
+			break;
 		nodes = max_group;
 	}
 	return nid;