All of lore.kernel.org
 help / color / mirror / Atom feed
* [gourryinverse:scratch/gourry/managed_nodes/rfc6 33/41] mm/page_alloc.c:4046 __alloc_pages_may_oom() warn: bitwise AND condition is false here
@ 2026-09-25  8:44 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2026-09-25  8:44 UTC (permalink / raw)
  To: oe-kbuild; +Cc: lkp, Dan Carpenter

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
CC: Gregory Price <gourry@gourry.net>
TO: Gregory Price <gourry@gourry.net>

tree:   https://github.com/gourryinverse/linux scratch/gourry/managed_nodes/rfc6
head:   8c5d814c9801de9fbf8962c8798c348e8d92bd7e
commit: a8817116bdcfb1521ea16cc621f74bfa8b70317f [33/41] mm/oom_kill: handle private NUMA policy constraints
:::::: branch date: 8 hours ago
:::::: commit date: 8 hours ago
config: nios2-randconfig-r2200-20260925 (https://download.01.org/0day-ci/archive/20260925/202609251016.H6GkbFFe-lkp@intel.com/config)
compiler: nios2-linux-gcc (GCC) 11.5.0
smatch: v0.5.0-9187-g5189e3fb

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 <lkp@intel.com>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Closes: https://lore.kernel.org/r/202609251016.H6GkbFFe-lkp@intel.com/

smatch warnings:
mm/page_alloc.c:4046 __alloc_pages_may_oom() warn: bitwise AND condition is false here

vim +4046 mm/page_alloc.c

6c18ba7a18997d Michal Hocko      2017-02-22  4039  
11e33f6a55ed78 Mel Gorman        2009-06-16  4040  static inline struct page *
11e33f6a55ed78 Mel Gorman        2009-06-16  4041  __alloc_pages_may_oom(gfp_t gfp_mask, unsigned int order,
a9263751e11a07 Vlastimil Babka   2015-02-11  4042  	const struct alloc_context *ac, unsigned long *did_some_progress)
^1da177e4c3f41 Linus Torvalds    2005-04-16  4043  {
6e0fc46dc2152d David Rientjes    2015-09-08  4044  	struct oom_control oc = {
6e0fc46dc2152d David Rientjes    2015-09-08  4045  		.zonelist = ac->zonelist,
a8817116bdcfb1 Gregory Price     2026-09-23 @4046  		.constraint_nodes = ac->alloc_flags & ALLOC_ZONELIST_PRIVATE ?
a8817116bdcfb1 Gregory Price     2026-09-23  4047  			&node_states[N_MEMORY] : &node_states[N_MEMORY_COMMON],
6e0fc46dc2152d David Rientjes    2015-09-08  4048  		.nodemask = ac->nodemask,
2a966b77ae3ede Vladimir Davydov  2016-07-26  4049  		.memcg = NULL,
6e0fc46dc2152d David Rientjes    2015-09-08  4050  		.gfp_mask = gfp_mask,
6e0fc46dc2152d David Rientjes    2015-09-08  4051  		.order = order,
6e0fc46dc2152d David Rientjes    2015-09-08  4052  	};
^1da177e4c3f41 Linus Torvalds    2005-04-16  4053  	struct page *page;
11e33f6a55ed78 Mel Gorman        2009-06-16  4054  
9879de7373fcfb Johannes Weiner   2015-01-26  4055  	*did_some_progress = 0;
9879de7373fcfb Johannes Weiner   2015-01-26  4056  
9879de7373fcfb Johannes Weiner   2015-01-26  4057  	/*
dc56401fc9f25e Johannes Weiner   2015-06-24  4058  	 * Acquire the oom lock.  If that fails, somebody else is
dc56401fc9f25e Johannes Weiner   2015-06-24  4059  	 * making progress for us.
9879de7373fcfb Johannes Weiner   2015-01-26  4060  	 */
dc56401fc9f25e Johannes Weiner   2015-06-24  4061  	if (!mutex_trylock(&oom_lock)) {
9879de7373fcfb Johannes Weiner   2015-01-26  4062  		*did_some_progress = 1;
11e33f6a55ed78 Mel Gorman        2009-06-16  4063  		schedule_timeout_uninterruptible(1);
11e33f6a55ed78 Mel Gorman        2009-06-16  4064  		return NULL;
11e33f6a55ed78 Mel Gorman        2009-06-16  4065  	}
11e33f6a55ed78 Mel Gorman        2009-06-16  4066  
11e33f6a55ed78 Mel Gorman        2009-06-16  4067  	/*
11e33f6a55ed78 Mel Gorman        2009-06-16  4068  	 * Go through the zonelist yet one more time, keep very high watermark
11e33f6a55ed78 Mel Gorman        2009-06-16  4069  	 * here, this is only to catch a parallel oom killing, we must fail if
e746bf730a76fe Tetsuo Handa      2017-08-31  4070  	 * we're still under heavy pressure. But make sure that this reclaim
e746bf730a76fe Tetsuo Handa      2017-08-31  4071  	 * attempt shall not depend on __GFP_DIRECT_RECLAIM && !__GFP_NORETRY
e746bf730a76fe Tetsuo Handa      2017-08-31  4072  	 * allocation which will never fail due to oom_lock already held.
11e33f6a55ed78 Mel Gorman        2009-06-16  4073  	 */
e746bf730a76fe Tetsuo Handa      2017-08-31  4074  	page = get_page_from_freelist((gfp_mask | __GFP_HARDWALL) &
e746bf730a76fe Tetsuo Handa      2017-08-31  4075  				      ~__GFP_DIRECT_RECLAIM, order,
6372aac4d41fcd Brendan Jackman   2026-07-03  4076  				      ac->alloc_flags|ALLOC_WMARK_HIGH|ALLOC_CPUSET, ac);
11e33f6a55ed78 Mel Gorman        2009-06-16  4077  	if (page)
11e33f6a55ed78 Mel Gorman        2009-06-16  4078  		goto out;
11e33f6a55ed78 Mel Gorman        2009-06-16  4079  
9879de7373fcfb Johannes Weiner   2015-01-26  4080  	/* Coredumps can quickly deplete all memory reserves */
9879de7373fcfb Johannes Weiner   2015-01-26  4081  	if (current->flags & PF_DUMPCORE)
9879de7373fcfb Johannes Weiner   2015-01-26  4082  		goto out;
11e33f6a55ed78 Mel Gorman        2009-06-16  4083  	/* The OOM killer will not help higher order allocs */
4365a5676fa3aa KAMEZAWA Hiroyuki 2009-12-15  4084  	if (order > PAGE_ALLOC_COSTLY_ORDER)
11e33f6a55ed78 Mel Gorman        2009-06-16  4085  		goto out;
dcda9b04713c3f Michal Hocko      2017-07-12  4086  	/*
dcda9b04713c3f Michal Hocko      2017-07-12  4087  	 * We have already exhausted all our reclaim opportunities without any
dcda9b04713c3f Michal Hocko      2017-07-12  4088  	 * success so it is time to admit defeat. We will skip the OOM killer
dcda9b04713c3f Michal Hocko      2017-07-12  4089  	 * because it is very likely that the caller has a more reasonable
dcda9b04713c3f Michal Hocko      2017-07-12  4090  	 * fallback than shooting a random task.
cfb4a541918498 Mateusz Nosek     2020-10-13  4091  	 *
cfb4a541918498 Mateusz Nosek     2020-10-13  4092  	 * The OOM killer may not free memory on a specific node.
dcda9b04713c3f Michal Hocko      2017-07-12  4093  	 */
cfb4a541918498 Mateusz Nosek     2020-10-13  4094  	if (gfp_mask & (__GFP_RETRY_MAYFAIL | __GFP_THISNODE))
dcda9b04713c3f Michal Hocko      2017-07-12  4095  		goto out;
03668b3ceb0c7a David Rientjes    2010-08-09  4096  	/* The OOM killer does not needlessly kill tasks for lowmem */
97a225e69a1f88 Joonsoo Kim       2020-06-03  4097  	if (ac->highest_zoneidx < ZONE_NORMAL)
03668b3ceb0c7a David Rientjes    2010-08-09  4098  		goto out;
9083905a2a13de Johannes Weiner   2015-06-24  4099  	if (pm_suspended_storage())
9083905a2a13de Johannes Weiner   2015-06-24  4100  		goto out;
3da88fb3bacfaa Michal Hocko      2016-05-19  4101  	/*
3da88fb3bacfaa Michal Hocko      2016-05-19  4102  	 * XXX: GFP_NOFS allocations should rather fail than rely on
3da88fb3bacfaa Michal Hocko      2016-05-19  4103  	 * other request to make a forward progress.
3da88fb3bacfaa Michal Hocko      2016-05-19  4104  	 * We are in an unfortunate situation where out_of_memory cannot
3da88fb3bacfaa Michal Hocko      2016-05-19  4105  	 * do much for this context but let's try it to at least get
3da88fb3bacfaa Michal Hocko      2016-05-19  4106  	 * access to memory reserved if the current task is killed (see
3da88fb3bacfaa Michal Hocko      2016-05-19  4107  	 * out_of_memory). Once filesystems are ready to handle allocation
3da88fb3bacfaa Michal Hocko      2016-05-19  4108  	 * failures more gracefully we should just bail out here.
3da88fb3bacfaa Michal Hocko      2016-05-19  4109  	 */
3da88fb3bacfaa Michal Hocko      2016-05-19  4110  
3c2c6488428433 Shile Zhang       2018-01-31  4111  	/* Exhausted what can be done so it's blame time */
3f913fc5f97456 Qi Zheng          2022-05-19  4112  	if (out_of_memory(&oc) ||
3f913fc5f97456 Qi Zheng          2022-05-19  4113  	    WARN_ON_ONCE_GFP(gfp_mask & __GFP_NOFAIL, gfp_mask)) {
9879de7373fcfb Johannes Weiner   2015-01-26  4114  		*did_some_progress = 1;
5020e285856cb4 Michal Hocko      2016-01-14  4115  
5020e285856cb4 Michal Hocko      2016-01-14  4116  		/*
6c18ba7a18997d Michal Hocko      2017-02-22  4117  		 * Help non-failing allocations by giving them access to memory
6c18ba7a18997d Michal Hocko      2017-02-22  4118  		 * reserves
5020e285856cb4 Michal Hocko      2016-01-14  4119  		 */
6c18ba7a18997d Michal Hocko      2017-02-22  4120  		if (gfp_mask & __GFP_NOFAIL)
6c18ba7a18997d Michal Hocko      2017-02-22  4121  			page = __alloc_pages_cpuset_fallback(gfp_mask, order,
6372aac4d41fcd Brendan Jackman   2026-07-03  4122  					ac->alloc_flags|ALLOC_NO_WATERMARKS, ac);
5020e285856cb4 Michal Hocko      2016-01-14  4123  	}
11e33f6a55ed78 Mel Gorman        2009-06-16  4124  out:
dc56401fc9f25e Johannes Weiner   2015-06-24  4125  	mutex_unlock(&oom_lock);
11e33f6a55ed78 Mel Gorman        2009-06-16  4126  	return page;
11e33f6a55ed78 Mel Gorman        2009-06-16  4127  }
11e33f6a55ed78 Mel Gorman        2009-06-16  4128  

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-09-25  8:45 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-25  8:44 [gourryinverse:scratch/gourry/managed_nodes/rfc6 33/41] mm/page_alloc.c:4046 __alloc_pages_may_oom() warn: bitwise AND condition is false here kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.