···2727 int flushtlb;2828};29293030-enum {3131- CPA_NO_SPLIT = 0,3232- CPA_SPLIT,3333-};3434-3530static inline int3631within(unsigned long addr, unsigned long start, unsigned long end)3732{···258263 unsigned long nextpage_addr, numpages, pmask, psize, flags;259264 pte_t new_pte, old_pte, *tmp;260265 pgprot_t old_prot, new_prot;261261- int level, res = CPA_SPLIT;266266+ int level, do_split = 1;262267263268 /*264269 * An Athlon 64 X2 showed hard hangs if we tried to preserve···269274 * disable this code until the hang can be debugged:270275 */271276 if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD)272272- return res;277277+ return 1;273278274279 spin_lock_irqsave(&pgd_lock, flags);275280 /*···292297 break;293298#endif294299 default:295295- res = -EINVAL;300300+ do_split = -EINVAL;296301 goto out_unlock;297302 }298303···320325 * above:321326 */322327 if (pgprot_val(new_prot) == pgprot_val(old_prot)) {323323- res = CPA_NO_SPLIT;328328+ do_split = 0;324329 goto out_unlock;325330 }326331···340345 new_pte = pfn_pte(pte_pfn(old_pte), canon_pgprot(new_prot));341346 __set_pmd_pte(kpte, address, new_pte);342347 cpa->flushtlb = 1;343343- res = CPA_NO_SPLIT;348348+ do_split = 0;344349 }345350346351out_unlock:347352 spin_unlock_irqrestore(&pgd_lock, flags);348353349349- return res;354354+ return do_split;350355}351356352357static int split_large_page(pte_t *kpte, unsigned long address)···424429static int __change_page_attr(unsigned long address, struct cpa_data *cpa)425430{426431 struct page *kpte_page;427427- int level, res;432432+ int level, do_split;428433 pte_t *kpte;429434430435repeat:···475480 * Check, whether we can keep the large page intact476481 * and just change the pte:477482 */478478- res = try_preserve_large_page(kpte, address, cpa);479479- if (res < 0)480480- return res;483483+ do_split = try_preserve_large_page(kpte, address, cpa);484484+ if (do_split < 0)485485+ return do_split;481486482487 /*483488 * When the range fits into the existing large page,484489 * return. cp->numpages and cpa->tlbflush have been updated in485490 * try_large_page:486491 */487487- if (res == CPA_NO_SPLIT)492492+ if (do_split == 0)488493 return 0;489494490495 /*491496 * We have to split the large page:492497 */493493- res = split_large_page(kpte, address);494494- if (res)495495- return res;498498+ do_split = split_large_page(kpte, address);499499+ if (do_split)500500+ return do_split;496501 cpa->flushtlb = 1;502502+497503 goto repeat;498504}499505