Re: [PATCH v1 1/2] mm: migrate: add vm event counters thp_migrate_(success|fail)

From: kbuild test robot
Date: Wed Apr 11 2018 - 15:16:49 EST


Hi Naoya,

I love your patch! Perhaps something to improve:

[auto build test WARNING on mmotm/master]
[also build test WARNING on next-20180411]
[cannot apply to v4.16]
[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/Naoya-Horiguchi/mm-migrate-add-vm-event-counters-thp_migrate_-success-fail/20180412-011244
base: git://git.cmpxchg.org/linux-mmotm.git master
config: i386-randconfig-a1-201814 (attached as .config)
compiler: gcc-4.9 (Debian 4.9.4-2) 4.9.4
reproduce:
# save the attached .config to linux build tree
make ARCH=i386

All warnings (new ones prefixed by >>):

mm/migrate.c: In function 'migrate_pages':
>> mm/migrate.c:1426:2: warning: missing braces around initializer [-Wmissing-braces]
int counts[MIGRATE_RESULT_TYPES][MIGRATE_PAGE_TYPES] = {0};
^
mm/migrate.c:1426:2: warning: (near initialization for 'counts[0]') [-Wmissing-braces]

vim +1426 mm/migrate.c

1400
1401 /*
1402 * migrate_pages - migrate the pages specified in a list, to the free pages
1403 * supplied as the target for the page migration
1404 *
1405 * @from: The list of pages to be migrated.
1406 * @get_new_page: The function used to allocate free pages to be used
1407 * as the target of the page migration.
1408 * @put_new_page: The function used to free target pages if migration
1409 * fails, or NULL if no special handling is necessary.
1410 * @private: Private data to be passed on to get_new_page()
1411 * @mode: The migration mode that specifies the constraints for
1412 * page migration, if any.
1413 * @reason: The reason for page migration.
1414 *
1415 * The function returns after 10 attempts or if no pages are movable any more
1416 * because the list has become empty or no retryable pages exist any more.
1417 * The caller should call putback_movable_pages() to return pages to the LRU
1418 * or free list only if ret != 0.
1419 *
1420 * Returns the number of pages that were not migrated, or an error code.
1421 */
1422 int migrate_pages(struct list_head *from, new_page_t get_new_page,
1423 free_page_t put_new_page, unsigned long private,
1424 enum migrate_mode mode, int reason)
1425 {
> 1426 int counts[MIGRATE_RESULT_TYPES][MIGRATE_PAGE_TYPES] = {0};
1427 int pass = 0;
1428 struct page *page;
1429 struct page *page2;
1430 int swapwrite = current->flags & PF_SWAPWRITE;
1431 int rc;
1432
1433 if (!swapwrite)
1434 current->flags |= PF_SWAPWRITE;
1435
1436 for (pass = 0; !pass || (pass < 10 && get_count(counts, MIGRATE_RETRY));
1437 pass++) {
1438 reset_nr_retry(counts);
1439
1440 list_for_each_entry_safe(page, page2, from, lru) {
1441 enum migrate_page_type mpt;
1442 retry:
1443 cond_resched();
1444
1445 mpt = get_type(page);
1446 if (PageHuge(page))
1447 rc = unmap_and_move_huge_page(get_new_page,
1448 put_new_page, private, page,
1449 pass > 2, mode, reason);
1450 else
1451 rc = unmap_and_move(get_new_page, put_new_page,
1452 private, page, pass > 2, mode,
1453 reason);
1454
1455 switch(rc) {
1456 case -ENOMEM:
1457 /*
1458 * THP migration might be unsupported or the
1459 * allocation could've failed so we should
1460 * retry on the same page with the THP split
1461 * to base pages.
1462 *
1463 * Head page is retried immediately and tail
1464 * pages are added to the tail of the list so
1465 * we encounter them after the rest of the list
1466 * is processed.
1467 */
1468 if (PageTransHuge(page)) {
1469 lock_page(page);
1470 rc = split_huge_page_to_list(page, from);
1471 unlock_page(page);
1472 if (!rc) {
1473 list_safe_reset_next(page, page2, lru);
1474 goto retry;
1475 }
1476 }
1477 counts[MIGRATE_FAIL][mpt]++;
1478 goto out;
1479 case -EAGAIN:
1480 counts[MIGRATE_RETRY][mpt]++;
1481 break;
1482 case MIGRATEPAGE_SUCCESS:
1483 counts[MIGRATE_SUCCEED][mpt]++;
1484 break;
1485 default:
1486 /*
1487 * Permanent failure (-EBUSY, -ENOSYS, etc.):
1488 * unlike -EAGAIN case, the failed page is
1489 * removed from migration page list and not
1490 * retried in the next outer loop.
1491 */
1492 counts[MIGRATE_FAIL][mpt]++;
1493 break;
1494 }
1495 }
1496 }
1497 rc = get_count(counts, MIGRATE_FAIL) + get_count(counts, MIGRATE_RETRY);
1498 out:
1499 update_vm_migrate_events(counts);
1500 trace_mm_migrate_pages(get_count(counts, MIGRATE_SUCCEED), rc,
1501 mode, reason);
1502
1503 if (!swapwrite)
1504 current->flags &= ~PF_SWAPWRITE;
1505
1506 return rc;
1507 }
1508

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

Attachment: .config.gz
Description: application/gzip