2013-08-29 09:47:53

by Stephen Rothwell

[permalink] [raw]
Subject: linux-next: build warnings after merge of the akpm-current tree

Hi Andrew,

After merging the akpm tree, today's linux-next build (sparc64 defconfig
and others) produced these warnings:

mm/page-writeback.c: In function 'balance_dirty_pages_ratelimited':
mm/page-writeback.c:1450:13: warning: 'bdi_thresh' may be used uninitialized in this function [-Wuninitialized]
mm/page-writeback.c:1372:16: note: 'bdi_thresh' was declared here
mm/page-writeback.c:1226:16: warning: 'bdi_dirty' may be used uninitialized in this function [-Wuninitialized]
mm/page-writeback.c:1369:16: note: 'bdi_dirty' was declared here

Possibly introduced by commit 34c547af1e23 ("mm/page-writeback.c: add
strictlimit feature"), but I am not sure anything can be done about them.

--
Cheers,
Stephen Rothwell [email protected]


Attachments:
(No filename) (760.00 B)
(No filename) (836.00 B)
Download all attachments

2013-08-29 11:24:59

by Maxim Patlasov

[permalink] [raw]
Subject: Re: linux-next: build warnings after merge of the akpm-current tree

Hi Stephen,

08/29/2013 01:47 PM, Stephen Rothwell пишет:
> Hi Andrew,
>
> After merging the akpm tree, today's linux-next build (sparc64 defconfig
> and others) produced these warnings:
>
> mm/page-writeback.c: In function 'balance_dirty_pages_ratelimited':
> mm/page-writeback.c:1450:13: warning: 'bdi_thresh' may be used uninitialized in this function [-Wuninitialized]
> mm/page-writeback.c:1372:16: note: 'bdi_thresh' was declared here
> mm/page-writeback.c:1226:16: warning: 'bdi_dirty' may be used uninitialized in this function [-Wuninitialized]
> mm/page-writeback.c:1369:16: note: 'bdi_dirty' was declared here
>
> Possibly introduced by commit 34c547af1e23 ("mm/page-writeback.c: add
> strictlimit feature"), but I am not sure anything can be done about them.
>

This looks as gcc glitch. So far as I didn't observe the warnings, the
version of gcc does matter. May be moving the definitions of the two
variables into for(;;){...} would help. Could you please give it a try?

Thanks,
Maxim

2013-08-29 19:42:12

by Andrew Morton

[permalink] [raw]
Subject: Re: linux-next: build warnings after merge of the akpm-current tree

On Thu, 29 Aug 2013 15:24:46 +0400 Maxim Patlasov <[email protected]> wrote:

> Hi Stephen,
>
> 08/29/2013 01:47 PM, Stephen Rothwell __________:
> > Hi Andrew,
> >
> > After merging the akpm tree, today's linux-next build (sparc64 defconfig
> > and others) produced these warnings:
> >
> > mm/page-writeback.c: In function 'balance_dirty_pages_ratelimited':
> > mm/page-writeback.c:1450:13: warning: 'bdi_thresh' may be used uninitialized in this function [-Wuninitialized]
> > mm/page-writeback.c:1372:16: note: 'bdi_thresh' was declared here
> > mm/page-writeback.c:1226:16: warning: 'bdi_dirty' may be used uninitialized in this function [-Wuninitialized]
> > mm/page-writeback.c:1369:16: note: 'bdi_dirty' was declared here
> >
> > Possibly introduced by commit 34c547af1e23 ("mm/page-writeback.c: add
> > strictlimit feature"), but I am not sure anything can be done about them.
> >
>
> This looks as gcc glitch. So far as I didn't observe the warnings, the
> version of gcc does matter. May be moving the definitions of the two
> variables into for(;;){...} would help. Could you please give it a try?

Shuffling the definitions around won't help. To fix this we'll need to
add more code and I hate adding runtime overhead to address
compile-time issues. So...

--- a/mm/page-writeback.c~a
+++ a/mm/page-writeback.c
@@ -1366,10 +1366,8 @@ static void balance_dirty_pages(struct a
{
unsigned long nr_reclaimable; /* = file_dirty + unstable_nfs */
unsigned long nr_dirty; /* = file_dirty + writeback + unstable_nfs */
- unsigned long bdi_dirty;
unsigned long background_thresh;
unsigned long dirty_thresh;
- unsigned long bdi_thresh;
long period;
long pause;
long max_pause;
@@ -1385,8 +1383,10 @@ static void balance_dirty_pages(struct a

for (;;) {
unsigned long now = jiffies;
- unsigned long dirty;
+ unsigned long uninitialized_var(bdi_thresh);
unsigned long thresh;
+ unsigned long uninitialized_var(bdi_dirty);
+ unsigned long dirty;
unsigned long bg_thresh;

/*
_