Re: A regression in recent 3.2 kernel: bdi_dirty_limit() divideerror

From: Wu Fengguang
Date: Sat Jan 07 2012 - 09:56:57 EST


Hi Ilya,

Thanks for the report!
Would you try if the attached patch can fix it?

Thanks,
Fengguang

On Fri, Jan 06, 2012 at 01:13:15PM -0800, ÐÐÑÑ ÐÑÐÐÐÐÐÐ wrote:
> Hello, Mr. Fengguang.
>
> As you know the 3.2 version of Linux kernel was just released, so I decided to try it out. After I sucessfully compiled it with the previously used configuration file a bug appeared: as soon as I try to log into X, the kernel crashes producing the trace which you can see in the attachements. In terminal or when just running kdm everything is ok, also everything is completely stable with 3.1.7, so I've guessed it is kernel regression. After some playing with 'git bisect' it has pinpointed me to this commit:
>
> http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=7381131cbcf7e15d201a0ffd782a4698efe4e740
>
> That's why I've sent you this mail. I've attached several photos of different traces which I got during bisecting (nothing hit the log or very small pieces of info). If any addtional info is needed I am ready to provide it to you.
>
> OS: Gentoo amd64 with vanilla 3.2 kernel.
>
> Best regards.
> Ilya Tumaykin.






Subject:
Date: Sat Jan 07 22:50:45 CST 2012

The uninitilized shift may lead to denominator=0 in
prop_fraction_percpu() and divide error in bdi_dirty_limit().

Signed-off-by: Wu Fengguang <fengguang.wu@xxxxxxxxx>
---
lib/proportions.c | 1 +
1 file changed, 1 insertion(+)

--- linux.orig/lib/proportions.c 2012-01-07 22:50:29.000000000 +0800
+++ linux/lib/proportions.c 2012-01-07 22:50:37.000000000 +0800
@@ -82,6 +82,7 @@ int prop_descriptor_init(struct prop_des

pd->index = 0;
pd->pg[0].shift = shift;
+ pd->pg[1].shift = shift;
mutex_init(&pd->mutex);
err = percpu_counter_init(&pd->pg[0].events, 0);
if (err)