Re: [PATCH 2/2] bdi: Use might_alloc()

From: kernel test robot
Date: Thu Jan 14 2021 - 00:08:36 EST


Hi Daniel,

I love your patch! Yet something to improve:

[auto build test ERROR on mmotm/master]

url: https://github.com/0day-ci/linux/commits/Daniel-Vetter/mm-dmapool-Use-might_alloc/20210113-215207
base: git://git.cmpxchg.org/linux-mmotm.git master
config: openrisc-randconfig-r011-20210113 (attached as .config)
compiler: or1k-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/95ad71591084350229e768f9c2be5350d504f896
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Daniel-Vetter/mm-dmapool-Use-might_alloc/20210113-215207
git checkout 95ad71591084350229e768f9c2be5350d504f896
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=openrisc

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

All errors (new ones prefixed by >>):

mm/backing-dev.c: In function 'wb_get_create':
>> mm/backing-dev.c:647:2: error: implicit declaration of function 'might_alloc'; did you mean 'might_lock'? [-Werror=implicit-function-declaration]
647 | might_alloc(gfp);
| ^~~~~~~~~~~
| might_lock
cc1: some warnings being treated as errors


vim +647 mm/backing-dev.c

616
617 /**
618 * wb_get_create - get wb for a given memcg, create if necessary
619 * @bdi: target bdi
620 * @memcg_css: cgroup_subsys_state of the target memcg (must have positive ref)
621 * @gfp: allocation mask to use
622 *
623 * Try to get the wb for @memcg_css on @bdi. If it doesn't exist, try to
624 * create one. The returned wb has its refcount incremented.
625 *
626 * This function uses css_get() on @memcg_css and thus expects its refcnt
627 * to be positive on invocation. IOW, rcu_read_lock() protection on
628 * @memcg_css isn't enough. try_get it before calling this function.
629 *
630 * A wb is keyed by its associated memcg. As blkcg implicitly enables
631 * memcg on the default hierarchy, memcg association is guaranteed to be
632 * more specific (equal or descendant to the associated blkcg) and thus can
633 * identify both the memcg and blkcg associations.
634 *
635 * Because the blkcg associated with a memcg may change as blkcg is enabled
636 * and disabled closer to root in the hierarchy, each wb keeps track of
637 * both the memcg and blkcg associated with it and verifies the blkcg on
638 * each lookup. On mismatch, the existing wb is discarded and a new one is
639 * created.
640 */
641 struct bdi_writeback *wb_get_create(struct backing_dev_info *bdi,
642 struct cgroup_subsys_state *memcg_css,
643 gfp_t gfp)
644 {
645 struct bdi_writeback *wb;
646
> 647 might_alloc(gfp);
648
649 if (!memcg_css->parent)
650 return &bdi->wb;
651
652 do {
653 rcu_read_lock();
654 wb = radix_tree_lookup(&bdi->cgwb_tree, memcg_css->id);
655 if (wb) {
656 struct cgroup_subsys_state *blkcg_css;
657
658 /* see whether the blkcg association has changed */
659 blkcg_css = cgroup_get_e_css(memcg_css->cgroup,
660 &io_cgrp_subsys);
661 if (unlikely(wb->blkcg_css != blkcg_css ||
662 !wb_tryget(wb)))
663 wb = NULL;
664 css_put(blkcg_css);
665 }
666 rcu_read_unlock();
667 } while (!wb && !cgwb_create(bdi, memcg_css, gfp));
668
669 return wb;
670 }
671

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip