Hi Xuefeng, Thank you for the patch! Yet something to improve: [auto build test ERROR on linus/master] [also build test ERROR on v5.0-rc8 next-20190225] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https://github.com/0day-ci/linux/commits/Xuefeng-Wang/Use-flush-tlb-last-level-when-change-protection/20190225-214747 config: x86_64-randconfig-x017-201908 (attached as .config) compiler: gcc-8 (Debian 8.2.0-21) 8.2.0 reproduce: # save the attached .config to linux build tree make ARCH=x86_64 All errors (new ones prefixed by >>): mm/mprotect.c: In function 'change_protection_range': >> mm/mprotect.c:290:3: error: implicit declaration of function '__flush_tlb_range'; did you mean 'flush_tlb_range'? [-Werror=implicit-function-declaration] __flush_tlb_range(vma, start, end, PAGE_SIZE, true); ^~~~~~~~~~~~~~~~~ flush_tlb_range cc1: some warnings being treated as errors vim +290 mm/mprotect.c 265 266 static unsigned long change_protection_range(struct vm_area_struct *vma, 267 unsigned long addr, unsigned long end, pgprot_t newprot, 268 int dirty_accountable, int prot_numa) 269 { 270 struct mm_struct *mm = vma->vm_mm; 271 pgd_t *pgd; 272 unsigned long next; 273 unsigned long start = addr; 274 unsigned long pages = 0; 275 276 BUG_ON(addr >= end); 277 pgd = pgd_offset(mm, addr); 278 flush_cache_range(vma, addr, end); 279 inc_tlb_flush_pending(mm); 280 do { 281 next = pgd_addr_end(addr, end); 282 if (pgd_none_or_clear_bad(pgd)) 283 continue; 284 pages += change_p4d_range(vma, pgd, addr, next, newprot, 285 dirty_accountable, prot_numa); 286 } while (pgd++, addr = next, addr != end); 287 288 /* Only flush the TLB if we actually modified any entries: */ 289 if (pages) > 290 __flush_tlb_range(vma, start, end, PAGE_SIZE, true); 291 dec_tlb_flush_pending(mm); 292 293 return pages; 294 } 295 --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation