Hi Vasily, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on v5.15-rc6] [cannot apply to hnaz-mm/master next-20211112] [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/0day-ci/linux/commits/Vasily-Averin/memcg-prohibit-unconditional-exceeding-the-limit-of-dying-tasks/20211020-160835 base: DEBUG invalid remote for branch v5.15-rc6 519d81956ee277b4419c723adfb154603c2565ba config: x86_64-rhel-8.3-kselftests (attached as .config) compiler: gcc-9 (Debian 9.3.0-22) 9.3.0 reproduce: # apt-get install sparse # sparse version: v0.6.4-dirty # https://github.com/0day-ci/linux/commit/fd30aeb6287dfe68bcf02c4d9634e342d6743d90 git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Vasily-Averin/memcg-prohibit-unconditional-exceeding-the-limit-of-dying-tasks/20211020-160835 git checkout fd30aeb6287dfe68bcf02c4d9634e342d6743d90 # save the attached .config to linux build tree make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' 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 sparse warnings: (new ones prefixed by >>) mm/memcontrol.c:4088:21: sparse: sparse: incompatible types in comparison expression (different address spaces): mm/memcontrol.c:4088:21: sparse: struct mem_cgroup_threshold_ary [noderef] __rcu * mm/memcontrol.c:4088:21: sparse: struct mem_cgroup_threshold_ary * mm/memcontrol.c:4090:21: sparse: sparse: incompatible types in comparison expression (different address spaces): mm/memcontrol.c:4090:21: sparse: struct mem_cgroup_threshold_ary [noderef] __rcu * mm/memcontrol.c:4090:21: sparse: struct mem_cgroup_threshold_ary * mm/memcontrol.c:4246:9: sparse: sparse: incompatible types in comparison expression (different address spaces): mm/memcontrol.c:4246:9: sparse: struct mem_cgroup_threshold_ary [noderef] __rcu * mm/memcontrol.c:4246:9: sparse: struct mem_cgroup_threshold_ary * mm/memcontrol.c:4340:9: sparse: sparse: incompatible types in comparison expression (different address spaces): mm/memcontrol.c:4340:9: sparse: struct mem_cgroup_threshold_ary [noderef] __rcu * mm/memcontrol.c:4340:9: sparse: struct mem_cgroup_threshold_ary * mm/memcontrol.c:5966:23: sparse: sparse: incompatible types in comparison expression (different address spaces): mm/memcontrol.c:5966:23: sparse: struct task_struct [noderef] __rcu * mm/memcontrol.c:5966:23: sparse: struct task_struct * mm/memcontrol.c: note: in included file: include/linux/memcontrol.h:752:9: sparse: sparse: context imbalance in 'lock_page_lruvec' - wrong count at exit include/linux/memcontrol.h:752:9: sparse: sparse: context imbalance in 'lock_page_lruvec_irq' - wrong count at exit include/linux/memcontrol.h:752:9: sparse: sparse: context imbalance in 'lock_page_lruvec_irqsave' - wrong count at exit >> mm/memcontrol.c:1826:70: sparse: sparse: non size-preserving integer to pointer cast mm/memcontrol.c:1987:6: sparse: sparse: context imbalance in 'lock_page_memcg' - wrong count at exit mm/memcontrol.c:2036:17: sparse: sparse: context imbalance in '__unlock_page_memcg' - unexpected unlock mm/memcontrol.c:5817:28: sparse: sparse: context imbalance in 'mem_cgroup_count_precharge_pte_range' - unexpected unlock mm/memcontrol.c:6011:36: sparse: sparse: context imbalance in 'mem_cgroup_move_charge_pte_range' - unexpected unlock vim +1826 mm/memcontrol.c 1765 1766 static enum oom_status mem_cgroup_oom(struct mem_cgroup *memcg, gfp_t mask, int order) 1767 { 1768 enum oom_status ret; 1769 bool locked; 1770 1771 if (order > PAGE_ALLOC_COSTLY_ORDER) 1772 return OOM_SKIPPED; 1773 1774 memcg_memory_event(memcg, MEMCG_OOM); 1775 1776 /* 1777 * We are in the middle of the charge context here, so we 1778 * don't want to block when potentially sitting on a callstack 1779 * that holds all kinds of filesystem and mm locks. 1780 * 1781 * cgroup1 allows disabling the OOM killer and waiting for outside 1782 * handling until the charge can succeed; remember the context and put 1783 * the task to sleep at the end of the page fault when all locks are 1784 * released. 1785 * 1786 * On the other hand, in-kernel OOM killer allows for an async victim 1787 * memory reclaim (oom_reaper) and that means that we are not solely 1788 * relying on the oom victim to make a forward progress and we can 1789 * invoke the oom killer here. 1790 * 1791 * Please note that mem_cgroup_out_of_memory might fail to find a 1792 * victim and then we have to bail out from the charge path. 1793 */ 1794 if (memcg->oom_kill_disable) { 1795 if (!current->in_user_fault) 1796 return OOM_SKIPPED; 1797 css_get(&memcg->css); 1798 current->memcg_in_oom = memcg; 1799 current->memcg_oom_gfp_mask = mask; 1800 current->memcg_oom_order = order; 1801 1802 return OOM_ASYNC; 1803 } 1804 1805 mem_cgroup_mark_under_oom(memcg); 1806 1807 locked = mem_cgroup_oom_trylock(memcg); 1808 1809 if (locked) 1810 mem_cgroup_oom_notify(memcg); 1811 1812 mem_cgroup_unmark_under_oom(memcg); 1813 if (mem_cgroup_out_of_memory(memcg, mask, order)) { 1814 ret = OOM_SUCCESS; 1815 } else { 1816 ret = OOM_FAILED; 1817 /* 1818 * In some rare cases mem_cgroup_out_of_memory() can return false. 1819 * If it was called from #PF it forces handle_mm_fault() 1820 * return VM_FAULT_OOM and executes pagefault_out_of_memory(). 1821 * memcg_in_oom is set here to notify pagefault_out_of_memory() 1822 * that it was a memcg-related failure and not allow to run 1823 * global OOM. 1824 */ 1825 if (current->in_user_fault) > 1826 current->memcg_in_oom = (struct mem_cgroup *)ret; 1827 } 1828 if (locked) 1829 mem_cgroup_oom_unlock(memcg); 1830 1831 return ret; 1832 } 1833 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org