mm: move common segment checks to separate helper function