mm/thp: split out pmd collapse flush into separate functions