Re: [PATCH v4 3/3] Revert "mm: numa: defer TLB flush for THP migration as long as possible"

kbuild test robot
2017-07-31T21:16:19Z

[-- Attachment #1: Type: text/plain, Size: 6591 bytes --]

Hi Nadav,

[auto build test ERROR on mmotm/master]
[also build test ERROR on v4.13-rc3 next-20170731]
[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/Nadav-Amit/mm-fixes-of-tlb_flush_pending/20170801-040423
base: git://git.cmpxchg.org/linux-mmotm.git master
config: i386-randconfig-x009-201731 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
# save the attached .config to linux build tree
make ARCH=i386

All errors (new ones prefixed by >>):

In file included from include/asm-generic/bug.h:4:0,
from arch/x86/include/asm/bug.h:81,
from include/linux/bug.h:4,
from include/linux/mmdebug.h:4,
from include/linux/mm.h:8,
from mm/huge_memory.c:10:
mm/huge_memory.c: In function 'do_huge_pmd_numa_page':
>> mm/huge_memory.c:1502:27: error: 'mm' undeclared (first use in this function)
if (mm_tlb_flush_pending(mm))
^
include/linux/compiler.h:156:30: note: in definition of macro '__trace_if'
if (__builtin_constant_p(!!(cond)) ? !!(cond) : \
^~~~
mm/huge_memory.c:1502:2: note: in expansion of macro 'if'
if (mm_tlb_flush_pending(mm))
^~
mm/huge_memory.c:1502:27: note: each undeclared identifier is reported only once for each function it appears in
if (mm_tlb_flush_pending(mm))
^
include/linux/compiler.h:156:30: note: in definition of macro '__trace_if'
if (__builtin_constant_p(!!(cond)) ? !!(cond) : \
^~~~
mm/huge_memory.c:1502:2: note: in expansion of macro 'if'
if (mm_tlb_flush_pending(mm))
^~

vim +/mm +1502 mm/huge_memory.c

1403
1404 /* NUMA hinting page fault entry point for trans huge pmds */
1405 int do_huge_pmd_numa_page(struct vm_fault *vmf, pmd_t pmd)
1406 {
1407 struct vm_area_struct *vma = vmf->vma;
1408 struct anon_vma *anon_vma = NULL;
1409 struct page *page;
1410 unsigned long haddr = vmf->address & HPAGE_PMD_MASK;
1411 int page_nid = -1, this_nid = numa_node_id();
1412 int target_nid, last_cpupid = -1;
1413 bool page_locked;
1414 bool migrated = false;
1415 bool was_writable;
1416 int flags = 0;
1417
1418 vmf->ptl = pmd_lock(vma->vm_mm, vmf->pmd);
1419 if (unlikely(!pmd_same(pmd, *vmf->pmd)))
1420 goto out_unlock;
1421
1422 /*
1423 * If there are potential migrations, wait for completion and retry
1424 * without disrupting NUMA hinting information. Do not relock and
1425 * check_same as the page may no longer be mapped.
1426 */
1427 if (unlikely(pmd_trans_migrating(*vmf->pmd))) {
1428 page = pmd_page(*vmf->pmd);
1429 if (!get_page_unless_zero(page))
1430 goto out_unlock;
1431 spin_unlock(vmf->ptl);
1432 wait_on_page_locked(page);
1433 put_page(page);
1434 goto out;
1435 }
1436
1437 page = pmd_page(pmd);
1438 BUG_ON(is_huge_zero_page(page));
1439 page_nid = page_to_nid(page);
1440 last_cpupid = page_cpupid_last(page);
1441 count_vm_numa_event(NUMA_HINT_FAULTS);
1442 if (page_nid == this_nid) {
1443 count_vm_numa_event(NUMA_HINT_FAULTS_LOCAL);
1444 flags |= TNF_FAULT_LOCAL;
1445 }
1446
1447 /* See similar comment in do_numa_page for explanation */
1448 if (!pmd_savedwrite(pmd))
1449 flags |= TNF_NO_GROUP;
1450
1451 /*
1452 * Acquire the page lock to serialise THP migrations but avoid dropping
1453 * page_table_lock if at all possible
1454 */
1455 page_locked = trylock_page(page);
1456 target_nid = mpol_misplaced(page, vma, haddr);
1457 if (target_nid == -1) {
1458 /* If the page was locked, there are no parallel migrations */
1459 if (page_locked)
1460 goto clear_pmdnuma;
1461 }
1462
1463 /* Migration could have started since the pmd_trans_migrating check */
1464 if (!page_locked) {
1465 page_nid = -1;
1466 if (!get_page_unless_zero(page))
1467 goto out_unlock;
1468 spin_unlock(vmf->ptl);
1469 wait_on_page_locked(page);
1470 put_page(page);
1471 goto out;
1472 }
1473
1474 /*
1475 * Page is misplaced. Page lock serialises migrations. Acquire anon_vma
1476 * to serialises splits
1477 */
1478 get_page(page);
1479 spin_unlock(vmf->ptl);
1480 anon_vma = page_lock_anon_vma_read(page);
1481
1482 /* Confirm the PMD did not change while page_table_lock was released */
1483 spin_lock(vmf->ptl);
1484 if (unlikely(!pmd_same(pmd, *vmf->pmd))) {
1485 unlock_page(page);
1486 put_page(page);
1487 page_nid = -1;
1488 goto out_unlock;
1489 }
1490
1491 /* Bail if we fail to protect against THP splits for any reason */
1492 if (unlikely(!anon_vma)) {
1493 put_page(page);
1494 page_nid = -1;
1495 goto clear_pmdnuma;
1496 }
1497
1498 /*
1499 * The page_table_lock above provides a memory barrier
1500 * with change_protection_range.
1501 */
> 1502 if (mm_tlb_flush_pending(mm))
1503 flush_tlb_range(vma, haddr, haddr + HPAGE_PMD_SIZE);
1504
1505 /*
1506 * Migrate the THP to the requested node, returns with page unlocked
1507 * and access rights restored.
1508 */
1509 spin_unlock(vmf->ptl);
1510 migrated = migrate_misplaced_transhuge_page(vma->vm_mm, vma,
1511 vmf->pmd, pmd, vmf->address, page, target_nid);
1512 if (migrated) {
1513 flags |= TNF_MIGRATED;
1514 page_nid = target_nid;
1515 } else
1516 flags |= TNF_MIGRATE_FAIL;
1517
1518 goto out;
1519 clear_pmdnuma:
1520 BUG_ON(!PageLocked(page));
1521 was_writable = pmd_savedwrite(pmd);
1522 pmd = pmd_modify(pmd, vma->vm_page_prot);
1523 pmd = pmd_mkyoung(pmd);
1524 if (was_writable)
1525 pmd = pmd_mkwrite(pmd);
1526 set_pmd_at(vma->vm_mm, haddr, vmf->pmd, pmd);
1527 update_mmu_cache_pmd(vma, vmf->address, vmf->pmd);
1528 unlock_page(page);
1529 out_unlock:
1530 spin_unlock(vmf->ptl);
1531
1532 out:
1533 if (anon_vma)
1534 page_unlock_anon_vma_read(anon_vma);
1535
1536 if (page_nid != -1)
1537 task_numa_fault(last_cpupid, page_nid, HPAGE_PMD_NR,
1538 flags);
1539
1540 return 0;
1541 }
1542

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 28635 bytes --]