Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=198.175.65.17 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795956919; b=2sLxjM1FA12pxKfFJf/jUJf+jaIhqSO+jZUnpiVBttlYbjOqbxjWSVZgcTUaQOJA9Wff 5La5vCWGmn+NHbMcNz6f0ZHSejcJdmjr1J3djlS2qD+eVFkMJg9NP81tepJUO8I/M0zPB 6BwRBF+wfb8upbTdoJPd3gtjEoweXFl7RzAsh1LzjvptoiOG1IAtWpfqxfQz0rUj3yWF7 fh6OLNFE1+nrwA4sprIlGJsxEjQYDMz3/aPPNwTx5YhtXC/kmdz5hUdr95OPjdKZjTQ5v DnRbybq/5ACmXdCd9hrIhkKkKhdOIT9VG2p+Qh9YQj9iAyVNaejsuD1Qaib8nXqSWIg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795956919; h=DMARC-Filter:DKIM-Signature:X-CSE-ConnectionGUID:X-CSE-MsgGUID: X-IronPort-AV:X-IronPort-AV:Received:X-CSE-ConnectionGUID: X-CSE-MsgGUID:X-ExtLoop1:X-IronPort-AV:Received:Received:Date:From:To: Cc:Subject:Message-ID:User-Agent; bh=bAjmsikXSVMHlfK88FNlhg4mIZ4nJC52lRsXXEJA204=; b=O5RcdK/r1oDCYVm6JyTIAlmsLADUImlxcmlLk0CWIMlJWXS2bVxvn3tFewTRq4ov0ZF9 jeFWu85GdBHNuz0Sj0nW/gQnIGNlW5K/u1RP6L6fG64+e91T8kfVqnNNzwx4A/MALAeP0 L6YqN/nKOcE+BPTlQERk6ikrCS8vvQ+M+5dwBIwwLZGvgT/XCma/odwHORw6zwcxrplxP UxY0kRtYCMhg6n6miLxtnutfsdUMUgpSX66xqfooC3kAVr3IDPy1A1jlj0Mp6hUC786qy UQsodxIzoPynEbngZXfb9g7HvW6CGZQ6R9RonPQ0Or/WZ0yXty/mCXNbrNEt78k6wew== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=VVYRv4Fz; arc=none smtp.remote-ip=198.175.65.17 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0AFE8606A31C for ; Sun, 29 Nov 2026 12:55:18 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 0AFE8606A31C Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=VVYRv4Fz DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1795956919; x=1827492919; h=date:from:to:cc:subject:message-id; bh=izK7mzSSPmGsBQai07xRSDzWRL41pA00FF68NEjhKhU=; b=VVYRv4FzZMhLdepWsBcftdvJRncZWfAp8Hwwv3MjTP1kSklL6ZkIDZ6V dkNNfOd44TYe3+pnbp1ObSB0LQ9UyJN41FA7+oW7gi04Wp1hjdXlkGRUF 6t1FaDrJp0+2ewjrTvNwcqG5/EI5HXz/LbWuanR0un33FG4xRAjyEpU1W d/NvUohQeVlvg31BApwHAVzXat1rgv4PtnunaekvGX37n3fPun4KUnEUu bcHAyqJexXapmwQoaUXKf3NIj08EH5ZmUluK0f8Hj3dPyNEbdsZaLFx5g ekOCa3QAokgswII+5yC++OyU9KBvBWzOdeMLGYqAAjjch406nqb5rFnBd A==; X-CSE-ConnectionGUID: iPkH66USQoGBUtij7ONFfA== X-CSE-MsgGUID: rtoshJ7YSy+bzIkFSjYGgg== X-IronPort-AV: E=McAfee;i="6800,10657,11981"; a="4791919" X-IronPort-AV: E=Sophos;i="6.27,240,1787036400"; d="scan'208";a="4791919" Received: from fmviesa002.fm.intel.com ([10.60.135.142]) by orvoesa109.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Nov 2026 04:55:18 -0800 X-CSE-ConnectionGUID: 98B1EvKwQ2WJcRIR09LNgA== X-CSE-MsgGUID: y1uYT6QgRJqVZ90k83Vhfg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.27,240,1787036400"; d="scan'208";a="12971926" Received: from igk-lkp-server01.igk.intel.com (HELO 146cf1e082f1) ([10.211.93.152]) by fmviesa002.fm.intel.com with ESMTP; 29 Nov 2026 04:55:18 -0800 Received: from kbuild by 146cf1e082f1 with local (Exim 4.98.2) (envelope-from ) id 1xXeR1-00000000144-0U3Y; Sun, 29 Nov 2026 12:55:15 +0000 Date: Sun, 29 Nov 2026 13:54:54 +0100 From: kernel test robot To: oe-kbuild@lists.linux.dev Cc: lkp@intel.com Subject: [kkdwivedi:reclaim-ext 166/249] mm/memcontrol.c:2943: undefined reference to `bpf_memcg_high_policy' Message-ID: <20261129134939.lGIX2v8l-lkp@intel.com> User-Agent: s-nail v14.9.25 X-Mailing-List: oe-kbuild@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list :::::: :::::: Manual check reason: "too many reports for this commit" :::::: BCC: lkp@intel.com CC: oe-kbuild-all@lists.linux.dev TO: Kumar Kartikeya Dwivedi tree: https://github.com/kkdwivedi/linux reclaim-ext head: 6b721024b59ae84266e5c2b29fd390ba4fa9c362 commit: 3e016ddbafeaf29b30351e39c4918de15f176da6 [166/249] memcg_ext: allow BPF to defer memory.high enforcement :::::: branch date: 12 hours ago :::::: commit date: 2 days ago config: sh-randconfig-2200-20261129 (https://download.01.org/0day-ci/archive/20261129/20261129134939.lGIX2v8l-lkp@intel.com/config) compiler: sh4-linux-gcc (GCC) 10.5.0 smatch: v0.5.0-9187-g5189e3fb reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20261129/20261129134939.lGIX2v8l-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot | Closes: https://lore.kernel.org/r/20261129134939.lGIX2v8l-lkp@intel.com/ Note: the kkdwivedi/reclaim-ext HEAD 6b721024b59ae84266e5c2b29fd390ba4fa9c362 builds fine. It only hurts bisectability. All errors (new ones prefixed by >>): sh4-linux-ld: mm/memcontrol.o: in function `try_charge_memcg': >> mm/memcontrol.c:2943: undefined reference to `bpf_memcg_high_policy' vim +2943 mm/memcontrol.c 3e016ddbafeaf2 Shakeel Butt 2026-09-21 2718 75fe8ec2380233 Johannes Weiner 2025-01-23 2719 static int try_charge_memcg(struct mem_cgroup *memcg, gfp_t gfp_mask, 0029e19ebf84dc Michal Hocko 2014-08-06 2720 unsigned int nr_pages) 8a9f3ccd24741b Balbir Singh 2008-02-07 2721 { 3e016ddbafeaf2 Shakeel Butt 2026-09-21 2722 struct mem_cgroup *leaf_memcg = memcg; a983b5ebee5720 Johannes Weiner 2018-01-31 2723 unsigned int batch = max(MEMCG_CHARGE_BATCH, nr_pages); d977aa939fcaff Chris Down 2020-08-06 2724 int nr_retries = MAX_RECLAIM_RETRIES; 6539cc053869bd Johannes Weiner 2014-08-06 2725 struct mem_cgroup *mem_over_limit; 3e32cb2e0a12b6 Johannes Weiner 2014-12-10 2726 struct page_counter *counter; 6539cc053869bd Johannes Weiner 2014-08-06 2727 unsigned long nr_reclaimed; a4ebf1b6ca1e01 Vasily Averin 2021-11-05 2728 bool passed_oom = false; d885a076d7a74e Bing Jiao 2026-03-21 2729 unsigned int reclaim_options; b70a2a21dc9d4a Johannes Weiner 2014-10-09 2730 bool drained = false; d6e103a757fa78 Roman Gushchin 2022-07-01 2731 bool raised_max_event = false; e22c6ed90aa91a Johannes Weiner 2020-08-06 2732 unsigned long pflags; fcc0669c5aa681 Shakeel Butt 2025-09-22 2733 bool allow_spinning = gfpflags_allow_spinning(gfp_mask); 374f65b1481992 Joe Damato 2026-08-31 2734 int ret = 0; a636b327f73114 KAMEZAWA Hiroyuki 2009-01-07 2735 6539cc053869bd Johannes Weiner 2014-08-06 2736 retry: 2fba5961c64c56 Shakeel Butt 2025-05-06 2737 if (consume_stock(memcg, nr_pages)) 374f65b1481992 Joe Damato 2026-08-31 2738 return ret; 8a9f3ccd24741b Balbir Singh 2008-02-07 2739 fcc0669c5aa681 Shakeel Butt 2025-09-22 2740 if (!allow_spinning) 01d37228d33104 Alexei Starovoitov 2025-02-21 2741 /* Avoid the refill and flush of the older stock */ 01d37228d33104 Alexei Starovoitov 2025-02-21 2742 batch = nr_pages; 01d37228d33104 Alexei Starovoitov 2025-02-21 2743 d885a076d7a74e Bing Jiao 2026-03-21 2744 reclaim_options = MEMCG_RECLAIM_MAY_SWAP; 7941d2145abc4d Johannes Weiner 2016-01-14 2745 if (!do_memsw_account() || 6071ca5201066f Johannes Weiner 2015-11-05 2746 page_counter_try_charge(&memcg->memsw, batch, &counter)) { 6071ca5201066f Johannes Weiner 2015-11-05 2747 if (page_counter_try_charge(&memcg->memory, batch, &counter)) 6539cc053869bd Johannes Weiner 2014-08-06 2748 goto done_restock; 7941d2145abc4d Johannes Weiner 2016-01-14 2749 if (do_memsw_account()) 3e32cb2e0a12b6 Johannes Weiner 2014-12-10 2750 page_counter_uncharge(&memcg->memsw, batch); 3e32cb2e0a12b6 Johannes Weiner 2014-12-10 2751 mem_over_limit = mem_cgroup_from_counter(counter, memory); 3fbe724424fb10 Johannes Weiner 2014-10-09 2752 } else { 3e32cb2e0a12b6 Johannes Weiner 2014-12-10 2753 mem_over_limit = mem_cgroup_from_counter(counter, memsw); 73b73bac90d974 Yosry Ahmed 2022-07-14 2754 reclaim_options &= ~MEMCG_RECLAIM_MAY_SWAP; 3fbe724424fb10 Johannes Weiner 2014-10-09 2755 } 6539cc053869bd Johannes Weiner 2014-08-06 2756 6539cc053869bd Johannes Weiner 2014-08-06 2757 if (batch > nr_pages) { 6539cc053869bd Johannes Weiner 2014-08-06 2758 batch = nr_pages; 6539cc053869bd Johannes Weiner 2014-08-06 2759 goto retry; 6539cc053869bd Johannes Weiner 2014-08-06 2760 } 6539cc053869bd Johannes Weiner 2014-08-06 2761 89a2848381b5fc Johannes Weiner 2016-10-27 2762 /* 89a2848381b5fc Johannes Weiner 2016-10-27 2763 * Prevent unbounded recursion when reclaim operations need to 89a2848381b5fc Johannes Weiner 2016-10-27 2764 * allocate memory. This might exceed the limits temporarily, 89a2848381b5fc Johannes Weiner 2016-10-27 2765 * but we prefer facilitating memory reclaim and getting back 89a2848381b5fc Johannes Weiner 2016-10-27 2766 * under the limit over triggering OOM kills in these cases. 89a2848381b5fc Johannes Weiner 2016-10-27 2767 */ 89a2848381b5fc Johannes Weiner 2016-10-27 2768 if (unlikely(current->flags & PF_MEMALLOC)) 89a2848381b5fc Johannes Weiner 2016-10-27 2769 goto force; 89a2848381b5fc Johannes Weiner 2016-10-27 2770 06b078fc065fe1 Johannes Weiner 2014-08-06 2771 if (unlikely(task_in_memcg_oom(current))) 06b078fc065fe1 Johannes Weiner 2014-08-06 2772 goto nomem; 06b078fc065fe1 Johannes Weiner 2014-08-06 2773 d0164adc89f6bb Mel Gorman 2015-11-06 2774 if (!gfpflags_allow_blocking(gfp_mask)) 6539cc053869bd Johannes Weiner 2014-08-06 2775 goto nomem; 6539cc053869bd Johannes Weiner 2014-08-06 2776 6b0d1083364fc8 Shakeel Butt 2026-07-28 2777 /* 6b0d1083364fc8 Shakeel Butt 2026-07-28 2778 * OOM victim still needs to charge memory to exit. OOM reaper should 6b0d1083364fc8 Shakeel Butt 2026-07-28 2779 * help but it might fail on mmap_lock contention. If the victim is a 6b0d1083364fc8 Shakeel Butt 2026-07-28 2780 * large thread group then all exiting threads might compete on oom_lock 6b0d1083364fc8 Shakeel Butt 2026-07-28 2781 * just to learn that there is nothing really killable anymore. Bail 6b0d1083364fc8 Shakeel Butt 2026-07-28 2782 * out early and fail the charge to expedite their exit. They are 6b0d1083364fc8 Shakeel Butt 2026-07-28 2783 * considered fully reclaimed by the oom reaper and they shouldn't 6b0d1083364fc8 Shakeel Butt 2026-07-28 2784 * contribute further charges. 6b0d1083364fc8 Shakeel Butt 2026-07-28 2785 */ 6b0d1083364fc8 Shakeel Butt 2026-07-28 2786 if (tsk_is_oom_victim(current) && 6b0d1083364fc8 Shakeel Butt 2026-07-28 2787 mm_flags_test(MMF_OOM_SKIP, current->signal->oom_mm)) 6b0d1083364fc8 Shakeel Butt 2026-07-28 2788 goto nomem; 6b0d1083364fc8 Shakeel Butt 2026-07-28 2789 fcc0669c5aa681 Shakeel Butt 2025-09-22 2790 __memcg_memory_event(mem_over_limit, MEMCG_MAX, allow_spinning); d6e103a757fa78 Roman Gushchin 2022-07-01 2791 raised_max_event = true; 241994ed8649f7 Johannes Weiner 2015-02-11 2792 e22c6ed90aa91a Johannes Weiner 2020-08-06 2793 psi_memstall_enter(&pflags); b70a2a21dc9d4a Johannes Weiner 2014-10-09 2794 nr_reclaimed = try_to_free_mem_cgroup_pages(mem_over_limit, nr_pages, 68cd9050d871e4 Dan Schatzberg 2024-01-03 2795 gfp_mask, reclaim_options, NULL); e22c6ed90aa91a Johannes Weiner 2020-08-06 2796 psi_memstall_leave(&pflags); 6539cc053869bd Johannes Weiner 2014-08-06 2797 61e02c745721a3 Johannes Weiner 2014-08-06 2798 if (mem_cgroup_margin(mem_over_limit) >= nr_pages) 6539cc053869bd Johannes Weiner 2014-08-06 2799 goto retry; 28c34c291e746a Johannes Weiner 2014-08-06 2800 b70a2a21dc9d4a Johannes Weiner 2014-10-09 2801 if (!drained) { 6d3d6aa22af305 Johannes Weiner 2014-12-10 2802 drain_all_stock(mem_over_limit); b70a2a21dc9d4a Johannes Weiner 2014-10-09 2803 drained = true; b70a2a21dc9d4a Johannes Weiner 2014-10-09 2804 goto retry; b70a2a21dc9d4a Johannes Weiner 2014-10-09 2805 } b70a2a21dc9d4a Johannes Weiner 2014-10-09 2806 28c34c291e746a Johannes Weiner 2014-08-06 2807 if (gfp_mask & __GFP_NORETRY) 28c34c291e746a Johannes Weiner 2014-08-06 2808 goto nomem; 6539cc053869bd Johannes Weiner 2014-08-06 2809 /* 6539cc053869bd Johannes Weiner 2014-08-06 2810 * Even though the limit is exceeded at this point, reclaim 6539cc053869bd Johannes Weiner 2014-08-06 2811 * may have been able to free some pages. Retry the charge 6539cc053869bd Johannes Weiner 2014-08-06 2812 * before killing the task. 6539cc053869bd Johannes Weiner 2014-08-06 2813 * 6539cc053869bd Johannes Weiner 2014-08-06 2814 * Only for regular pages, though: huge pages are rather 6539cc053869bd Johannes Weiner 2014-08-06 2815 * unlikely to succeed so close to the limit, and we fall back 6539cc053869bd Johannes Weiner 2014-08-06 2816 * to regular pages anyway in case of failure. 6539cc053869bd Johannes Weiner 2014-08-06 2817 */ 61e02c745721a3 Johannes Weiner 2014-08-06 2818 if (nr_reclaimed && nr_pages <= (1 << PAGE_ALLOC_COSTLY_ORDER)) 6539cc053869bd Johannes Weiner 2014-08-06 2819 goto retry; 7a81b88cb53e33 KAMEZAWA Hiroyuki 2009-01-07 2820 9b1306192d3357 Johannes Weiner 2014-08-06 2821 if (nr_retries--) 9b1306192d3357 Johannes Weiner 2014-08-06 2822 goto retry; 9b1306192d3357 Johannes Weiner 2014-08-06 2823 38d384932ed1b5 Shakeel Butt 2019-07-11 2824 if (gfp_mask & __GFP_RETRY_MAYFAIL) 29ef680ae7c211 Michal Hocko 2018-08-17 2825 goto nomem; 29ef680ae7c211 Michal Hocko 2018-08-17 2826 a4ebf1b6ca1e01 Vasily Averin 2021-11-05 2827 /* Avoid endless loop for tasks bypassed by the oom killer */ a4ebf1b6ca1e01 Vasily Averin 2021-11-05 2828 if (passed_oom && task_is_dying()) a4ebf1b6ca1e01 Vasily Averin 2021-11-05 2829 goto nomem; 6d61ef409d6ba1 Balbir Singh 2009-01-07 2830 29ef680ae7c211 Michal Hocko 2018-08-17 2831 /* 29ef680ae7c211 Michal Hocko 2018-08-17 2832 * keep retrying as long as the memcg oom killer is able to make 29ef680ae7c211 Michal Hocko 2018-08-17 2833 * a forward progress or bypass the charge if the oom killer 29ef680ae7c211 Michal Hocko 2018-08-17 2834 * couldn't make any progress. 29ef680ae7c211 Michal Hocko 2018-08-17 2835 */ becdf89d776c8f Shakeel Butt 2022-03-22 2836 if (mem_cgroup_oom(mem_over_limit, gfp_mask, becdf89d776c8f Shakeel Butt 2022-03-22 2837 get_order(nr_pages * PAGE_SIZE))) { a4ebf1b6ca1e01 Vasily Averin 2021-11-05 2838 passed_oom = true; d977aa939fcaff Chris Down 2020-08-06 2839 nr_retries = MAX_RECLAIM_RETRIES; 29ef680ae7c211 Michal Hocko 2018-08-17 2840 goto retry; 29ef680ae7c211 Michal Hocko 2018-08-17 2841 } 7a81b88cb53e33 KAMEZAWA Hiroyuki 2009-01-07 2842 nomem: 1461e8c2b6af89 Shakeel Butt 2022-03-22 2843 /* 1461e8c2b6af89 Shakeel Butt 2022-03-22 2844 * Memcg doesn't have a dedicated reserve for atomic 1461e8c2b6af89 Shakeel Butt 2022-03-22 2845 * allocations. But like the global atomic pool, we need to 1461e8c2b6af89 Shakeel Butt 2022-03-22 2846 * put the burden of reclaim on regular allocation requests 1461e8c2b6af89 Shakeel Butt 2022-03-22 2847 * and let these go through as privileged allocations. 1461e8c2b6af89 Shakeel Butt 2022-03-22 2848 */ 374f65b1481992 Joe Damato 2026-08-31 2849 if (!(gfp_mask & (__GFP_NOFAIL | __GFP_HIGH))) { 374f65b1481992 Joe Damato 2026-08-31 2850 ret = -ENOMEM; 374f65b1481992 Joe Damato 2026-08-31 2851 goto out; 374f65b1481992 Joe Damato 2026-08-31 2852 } 10d53c748bc953 Tejun Heo 2015-11-05 2853 force: 10d53c748bc953 Tejun Heo 2015-11-05 2854 /* 10d53c748bc953 Tejun Heo 2015-11-05 2855 * The allocation either can't fail or will lead to more memory 10d53c748bc953 Tejun Heo 2015-11-05 2856 * being freed very soon. Allow memory usage go over the limit 10d53c748bc953 Tejun Heo 2015-11-05 2857 * temporarily by force charging it. 10d53c748bc953 Tejun Heo 2015-11-05 2858 */ 10d53c748bc953 Tejun Heo 2015-11-05 2859 page_counter_charge(&memcg->memory, nr_pages); 7941d2145abc4d Johannes Weiner 2016-01-14 2860 if (do_memsw_account()) 10d53c748bc953 Tejun Heo 2015-11-05 2861 page_counter_charge(&memcg->memsw, nr_pages); 10d53c748bc953 Tejun Heo 2015-11-05 2862 374f65b1481992 Joe Damato 2026-08-31 2863 out: 374f65b1481992 Joe Damato 2026-08-31 2864 /* 374f65b1481992 Joe Damato 2026-08-31 2865 * Don't forget to raise a MEMCG_MAX event for forced or rejected 374f65b1481992 Joe Damato 2026-08-31 2866 * requests. 374f65b1481992 Joe Damato 2026-08-31 2867 */ 374f65b1481992 Joe Damato 2026-08-31 2868 if (!raised_max_event) 374f65b1481992 Joe Damato 2026-08-31 2869 __memcg_memory_event(mem_over_limit, MEMCG_MAX, allow_spinning); 374f65b1481992 Joe Damato 2026-08-31 2870 374f65b1481992 Joe Damato 2026-08-31 2871 return ret; 6539cc053869bd Johannes Weiner 2014-08-06 2872 6539cc053869bd Johannes Weiner 2014-08-06 2873 done_restock: 6539cc053869bd Johannes Weiner 2014-08-06 2874 if (batch > nr_pages) 6539cc053869bd Johannes Weiner 2014-08-06 2875 refill_stock(memcg, batch - nr_pages); b23afb93d317c6 Tejun Heo 2015-11-05 2876 241994ed8649f7 Johannes Weiner 2015-02-11 2877 /* b23afb93d317c6 Tejun Heo 2015-11-05 2878 * If the hierarchy is above the normal consumption range, schedule b23afb93d317c6 Tejun Heo 2015-11-05 2879 * reclaim on returning to userland. We can perform reclaim here 71baba4b92dc1f Mel Gorman 2015-11-06 2880 * if __GFP_RECLAIM but let's always punt for simplicity and so that b23afb93d317c6 Tejun Heo 2015-11-05 2881 * GFP_KERNEL can consistently be used during reclaim. @memcg is b23afb93d317c6 Tejun Heo 2015-11-05 2882 * not recorded as it most likely matches current's and won't b23afb93d317c6 Tejun Heo 2015-11-05 2883 * change in the meantime. As high limit is checked again before b23afb93d317c6 Tejun Heo 2015-11-05 2884 * reclaim, the cost of mismatch is negligible. 241994ed8649f7 Johannes Weiner 2015-02-11 2885 */ 241994ed8649f7 Johannes Weiner 2015-02-11 2886 do { 4b82ab4f288366 Jakub Kicinski 2020-06-01 2887 bool mem_high, swap_high; 4b82ab4f288366 Jakub Kicinski 2020-06-01 2888 4b82ab4f288366 Jakub Kicinski 2020-06-01 2889 mem_high = page_counter_read(&memcg->memory) > 4b82ab4f288366 Jakub Kicinski 2020-06-01 2890 READ_ONCE(memcg->memory.high); 4b82ab4f288366 Jakub Kicinski 2020-06-01 2891 swap_high = page_counter_read(&memcg->swap) > 4b82ab4f288366 Jakub Kicinski 2020-06-01 2892 READ_ONCE(memcg->swap.high); 4b82ab4f288366 Jakub Kicinski 2020-06-01 2893 f7e1cb6ec51b04 Johannes Weiner 2016-01-14 2894 /* Don't bother a random interrupted task */ 086f694a75e1a2 Shakeel Butt 2022-03-22 2895 if (!in_task()) { 4b82ab4f288366 Jakub Kicinski 2020-06-01 2896 if (mem_high) { bffa47f1ca0095 David Stevens 2026-09-04 2897 if (allow_spinning) f7e1cb6ec51b04 Johannes Weiner 2016-01-14 2898 schedule_work(&memcg->high_work); bffa47f1ca0095 David Stevens 2026-09-04 2899 else bffa47f1ca0095 David Stevens 2026-09-04 2900 irq_work_queue(&memcg->high_irq_work); f7e1cb6ec51b04 Johannes Weiner 2016-01-14 2901 break; f7e1cb6ec51b04 Johannes Weiner 2016-01-14 2902 } 4b82ab4f288366 Jakub Kicinski 2020-06-01 2903 continue; 4b82ab4f288366 Jakub Kicinski 2020-06-01 2904 } 4b82ab4f288366 Jakub Kicinski 2020-06-01 2905 4b82ab4f288366 Jakub Kicinski 2020-06-01 2906 if (mem_high || swap_high) { 4b82ab4f288366 Jakub Kicinski 2020-06-01 2907 /* 4b82ab4f288366 Jakub Kicinski 2020-06-01 2908 * The allocating tasks in this cgroup will need to do 4b82ab4f288366 Jakub Kicinski 2020-06-01 2909 * reclaim or be throttled to prevent further growth 4b82ab4f288366 Jakub Kicinski 2020-06-01 2910 * of the memory or swap footprints. 4b82ab4f288366 Jakub Kicinski 2020-06-01 2911 * 4b82ab4f288366 Jakub Kicinski 2020-06-01 2912 * Target some best-effort fairness between the tasks, 4b82ab4f288366 Jakub Kicinski 2020-06-01 2913 * and distribute reclaim work and delay penalties 4b82ab4f288366 Jakub Kicinski 2020-06-01 2914 * based on how much each task is actually allocating. 4b82ab4f288366 Jakub Kicinski 2020-06-01 2915 */ 9516a18a9a253a Vladimir Davydov 2015-12-11 2916 current->memcg_nr_pages_over_high += batch; b23afb93d317c6 Tejun Heo 2015-11-05 2917 set_notify_resume(current); b23afb93d317c6 Tejun Heo 2015-11-05 2918 break; b23afb93d317c6 Tejun Heo 2015-11-05 2919 } 241994ed8649f7 Johannes Weiner 2015-02-11 2920 } while ((memcg = parent_mem_cgroup(memcg))); 10d53c748bc953 Tejun Heo 2015-11-05 2921 63fd327016fdfc Johannes Weiner 2024-01-11 2922 /* 63fd327016fdfc Johannes Weiner 2024-01-11 2923 * Reclaim is set up above to be called from the userland 63fd327016fdfc Johannes Weiner 2024-01-11 2924 * return path. But also attempt synchronous reclaim to avoid 63fd327016fdfc Johannes Weiner 2024-01-11 2925 * excessive overrun while the task is still inside the 63fd327016fdfc Johannes Weiner 2024-01-11 2926 * kernel. If this is successful, the return path will see it 63fd327016fdfc Johannes Weiner 2024-01-11 2927 * when it rechecks the overage and simply bail out. 63fd327016fdfc Johannes Weiner 2024-01-11 2928 */ c9afe31ec443ea Shakeel Butt 2022-03-22 2929 if (current->memcg_nr_pages_over_high > MEMCG_CHARGE_BATCH && c9afe31ec443ea Shakeel Butt 2022-03-22 2930 !(current->flags & PF_MEMALLOC) && 3e016ddbafeaf2 Shakeel Butt 2026-09-21 2931 gfpflags_allow_blocking(gfp_mask)) { 3e016ddbafeaf2 Shakeel Butt 2026-09-21 2932 /* 3e016ddbafeaf2 Shakeel Butt 2026-09-21 2933 * The loop above left @memcg as the first memcg it found over 3e016ddbafeaf2 Shakeel Butt 2026-09-21 2934 * memory.high or swap.high -- possibly the charged one itself 3e016ddbafeaf2 Shakeel Butt 2026-09-21 2935 * -- or NULL if it found none. Note the debt can be left over 3e016ddbafeaf2 Shakeel Butt 2026-09-21 2936 * from an earlier charge, so NULL does not mean no pressure. 3e016ddbafeaf2 Shakeel Butt 2026-09-21 2937 * The policy wants the memcg we charged. 3e016ddbafeaf2 Shakeel Butt 2026-09-21 2938 */ 3e016ddbafeaf2 Shakeel Butt 2026-09-21 2939 if (!bpf_memcg_high_defer(leaf_memcg, memcg, gfp_mask)) ec45783fce52f3 Thomas Gleixner 2025-08-13 2940 __mem_cgroup_handle_over_high(gfp_mask); 3e016ddbafeaf2 Shakeel Butt 2026-09-21 2941 } 374f65b1481992 Joe Damato 2026-08-31 2942 return ret; 8a9f3ccd24741b Balbir Singh 2008-02-07 @2943 } 8a9f3ccd24741b Balbir Singh 2008-02-07 2944 :::::: The code at line 2943 was first introduced by commit :::::: 8a9f3ccd24741b50200c3f33d62534c7271f3dfc Memory controller: memory accounting :::::: TO: Balbir Singh :::::: CC: Linus Torvalds -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki