linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [mmotm:master 159/293] mm/page_alloc.c:3546:15: warning: 'alloc_flags' may be used uninitialized in this function
@ 2017-01-21  4:01 kbuild test robot
  2017-01-23 21:48 ` Andrew Morton
  0 siblings, 1 reply; 2+ messages in thread
From: kbuild test robot @ 2017-01-21  4:01 UTC (permalink / raw)
  To: Michal Hocko
  Cc: kbuild-all, Johannes Weiner, Andrew Morton, Linux Memory Management List

[-- Attachment #1: Type: text/plain, Size: 3030 bytes --]

tree:   git://git.cmpxchg.org/linux-mmotm.git master
head:   fa78008f505569e7988ed3eb737ca7d43d87eac3
commit: 6f387b30fdba17b62b7c13d67d3caebbcc3bef0c [159/293] mm: consolidate GFP_NOFAIL checks in the allocator slowpath
config: i386-allmodconfig (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
        git checkout 6f387b30fdba17b62b7c13d67d3caebbcc3bef0c
        # save the attached .config to linux build tree
        make ARCH=i386 

Note: it may well be a FALSE warning. FWIW you are at least aware of it now.
http://gcc.gnu.org/wiki/Better_Uninitialized_Warnings

All warnings (new ones prefixed by >>):

   mm/page_alloc.c: In function '__alloc_pages_slowpath':
>> mm/page_alloc.c:3546:15: warning: 'alloc_flags' may be used uninitialized in this function [-Wmaybe-uninitialized]
     unsigned int alloc_flags;
                  ^~~~~~~~~~~

vim +/alloc_flags +3546 mm/page_alloc.c

ede377137 Michal Hocko    2016-05-20  3530  			else
ede377137 Michal Hocko    2016-05-20  3531  				cond_resched();
ede377137 Michal Hocko    2016-05-20  3532  
0a0337e0d Michal Hocko    2016-05-20  3533  			return true;
0a0337e0d Michal Hocko    2016-05-20  3534  		}
0a0337e0d Michal Hocko    2016-05-20  3535  	}
0a0337e0d Michal Hocko    2016-05-20  3536  
0a0337e0d Michal Hocko    2016-05-20  3537  	return false;
0a0337e0d Michal Hocko    2016-05-20  3538  }
0a0337e0d Michal Hocko    2016-05-20  3539  
11e33f6a5 Mel Gorman      2009-06-16  3540  static inline struct page *
11e33f6a5 Mel Gorman      2009-06-16  3541  __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order,
a9263751e Vlastimil Babka 2015-02-11  3542  						struct alloc_context *ac)
11e33f6a5 Mel Gorman      2009-06-16  3543  {
d0164adc8 Mel Gorman      2015-11-06  3544  	bool can_direct_reclaim = gfp_mask & __GFP_DIRECT_RECLAIM;
11e33f6a5 Mel Gorman      2009-06-16  3545  	struct page *page = NULL;
c603844bd Mel Gorman      2016-05-19 @3546  	unsigned int alloc_flags;
11e33f6a5 Mel Gorman      2009-06-16  3547  	unsigned long did_some_progress;
ca01798b3 Vlastimil Babka 2017-01-21  3548  	enum compact_priority compact_priority;
c5d01d0d1 Michal Hocko    2016-05-20  3549  	enum compact_result compact_result;
ca01798b3 Vlastimil Babka 2017-01-21  3550  	int compaction_retries;
ca01798b3 Vlastimil Babka 2017-01-21  3551  	int no_progress_loops;
63f53dea0 Michal Hocko    2016-10-07  3552  	unsigned long alloc_start = jiffies;
63f53dea0 Michal Hocko    2016-10-07  3553  	unsigned int stall_timeout = 10 * HZ;
ca01798b3 Vlastimil Babka 2017-01-21  3554  	unsigned int cpuset_mems_cookie;

:::::: The code at line 3546 was first introduced by commit
:::::: c603844bdcb5238980de8d58b393f52d7729d651 mm, page_alloc: convert alloc_flags to unsigned

:::::: TO: Mel Gorman <mgorman@techsingularity.net>
:::::: CC: Linus Torvalds <torvalds@linux-foundation.org>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 57967 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [mmotm:master 159/293] mm/page_alloc.c:3546:15: warning: 'alloc_flags' may be used uninitialized in this function
  2017-01-21  4:01 [mmotm:master 159/293] mm/page_alloc.c:3546:15: warning: 'alloc_flags' may be used uninitialized in this function kbuild test robot
@ 2017-01-23 21:48 ` Andrew Morton
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Morton @ 2017-01-23 21:48 UTC (permalink / raw)
  To: kbuild test robot
  Cc: Michal Hocko, kbuild-all, Johannes Weiner, Linux Memory Management List

On Sat, 21 Jan 2017 12:01:26 +0800 kbuild test robot <fengguang.wu@intel.com> wrote:

> tree:   git://git.cmpxchg.org/linux-mmotm.git master
> head:   fa78008f505569e7988ed3eb737ca7d43d87eac3
> commit: 6f387b30fdba17b62b7c13d67d3caebbcc3bef0c [159/293] mm: consolidate GFP_NOFAIL checks in the allocator slowpath
> config: i386-allmodconfig (attached as .config)
> compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
> reproduce:
>         git checkout 6f387b30fdba17b62b7c13d67d3caebbcc3bef0c
>         # save the attached .config to linux build tree
>         make ARCH=i386 
> 
> Note: it may well be a FALSE warning. FWIW you are at least aware of it now.
> http://gcc.gnu.org/wiki/Better_Uninitialized_Warnings
> 
> All warnings (new ones prefixed by >>):
> 
>    mm/page_alloc.c: In function '__alloc_pages_slowpath':
> >> mm/page_alloc.c:3546:15: warning: 'alloc_flags' may be used uninitialized in this function [-Wmaybe-uninitialized]
>      unsigned int alloc_flags;
>                   ^~~~~~~~~~~

Yup.  I guess we initialize alloc_flags before the `goto nopage'.

--- a/mm/page_alloc.c~mm-consolidate-gfp_nofail-checks-in-the-allocator-slowpath-fix
+++ a/mm/page_alloc.c
@@ -3577,6 +3577,14 @@ retry_cpuset:
 	no_progress_loops = 0;
 	compact_priority = DEF_COMPACT_PRIORITY;
 	cpuset_mems_cookie = read_mems_allowed_begin();
+
+	/*
+	 * The fast path uses conservative alloc_flags to succeed only until
+	 * kswapd needs to be woken up, and to avoid the cost of setting up
+	 * alloc_flags precisely. So we do that now.
+	 */
+	alloc_flags = gfp_to_alloc_flags(gfp_mask);
+
 	/*
 	 * We need to recalculate the starting point for the zonelist iterator
 	 * because we might have used different nodemask in the fast path, or
@@ -3588,14 +3596,6 @@ retry_cpuset:
 	if (!ac->preferred_zoneref->zone)
 		goto nopage;
 
-
-	/*
-	 * The fast path uses conservative alloc_flags to succeed only until
-	 * kswapd needs to be woken up, and to avoid the cost of setting up
-	 * alloc_flags precisely. So we do that now.
-	 */
-	alloc_flags = gfp_to_alloc_flags(gfp_mask);
-
 	if (gfp_mask & __GFP_KSWAPD_RECLAIM)
 		wake_all_kswapds(order, ac);
 
_

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-01-23 21:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-21  4:01 [mmotm:master 159/293] mm/page_alloc.c:3546:15: warning: 'alloc_flags' may be used uninitialized in this function kbuild test robot
2017-01-23 21:48 ` Andrew Morton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox