Re: [PATCH v12 2/7] mm: factor helpers for memory_failure_dev_pagemap

From: kernel test robot
Date: Sun Apr 10 2022 - 16:23:41 EST


Hi Shiyang,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on hnaz-mm/master]
[also build test WARNING on next-20220408]
[cannot apply to xfs-linux/for-next linus/master linux/master v5.18-rc1]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url: https://github.com/intel-lab-lkp/linux/commits/Shiyang-Ruan/fsdax-introduce-fs-query-to-support-reflink/20220411-001048
base: https://github.com/hnaz/linux-mm master
config: x86_64-randconfig-a011 (https://download.01.org/0day-ci/archive/20220411/202204110420.O844CZYb-lkp@xxxxxxxxx/config)
compiler: gcc-11 (Debian 11.2.0-19) 11.2.0
reproduce (this is a W=1 build):
# https://github.com/intel-lab-lkp/linux/commit/9ab00d3f6d4d9d3d2e4446480567af17c8726bd2
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Shiyang-Ruan/fsdax-introduce-fs-query-to-support-reflink/20220411-001048
git checkout 9ab00d3f6d4d9d3d2e4446480567af17c8726bd2
# save the config file to linux build tree
mkdir build_dir
make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

mm/memory-failure.c: In function 'mf_generic_kill_procs':
>> mm/memory-failure.c:1533:13: warning: variable 'rc' set but not used [-Wunused-but-set-variable]
1533 | int rc = 0;
| ^~


vim +/rc +1533 mm/memory-failure.c

1526
1527 static int mf_generic_kill_procs(unsigned long long pfn, int flags,
1528 struct dev_pagemap *pgmap)
1529 {
1530 struct page *page = pfn_to_page(pfn);
1531 LIST_HEAD(to_kill);
1532 dax_entry_t cookie;
> 1533 int rc = 0;
1534
1535 /*
1536 * Pages instantiated by device-dax (not filesystem-dax)
1537 * may be compound pages.
1538 */
1539 page = compound_head(page);
1540
1541 /*
1542 * Prevent the inode from being freed while we are interrogating
1543 * the address_space, typically this would be handled by
1544 * lock_page(), but dax pages do not use the page lock. This
1545 * also prevents changes to the mapping of this pfn until
1546 * poison signaling is complete.
1547 */
1548 cookie = dax_lock_page(page);
1549 if (!cookie)
1550 return -EBUSY;
1551
1552 if (hwpoison_filter(page)) {
1553 rc = -EOPNOTSUPP;
1554 goto unlock;
1555 }
1556
1557 if (pgmap->type == MEMORY_DEVICE_PRIVATE) {
1558 /*
1559 * TODO: Handle HMM pages which may need coordination
1560 * with device-side memory.
1561 */
1562 return -EBUSY;
1563 }
1564
1565 /*
1566 * Use this flag as an indication that the dax page has been
1567 * remapped UC to prevent speculative consumption of poison.
1568 */
1569 SetPageHWPoison(page);
1570
1571 /*
1572 * Unlike System-RAM there is no possibility to swap in a
1573 * different physical page at a given virtual address, so all
1574 * userspace consumption of ZONE_DEVICE memory necessitates
1575 * SIGBUS (i.e. MF_MUST_KILL)
1576 */
1577 flags |= MF_ACTION_REQUIRED | MF_MUST_KILL;
1578 collect_procs(page, &to_kill, true);
1579
1580 unmap_and_kill(&to_kill, pfn, page->mapping, page->index, flags);
1581 unlock:
1582 dax_unlock_page(page, cookie);
1583 return 0;
1584 }
1585

--
0-DAY CI Kernel Test Service
https://01.org/lkp