[Bug 86778] Re: Precedence bug in patch

Colin King colin.king at ubuntu.com
Thu Sep 4 14:25:18 UTC 2008

SRU Justification:

Impact: The mm zone page calculations are being miscalculated because of
a previous commit.

Fix: Add parentheses around >> operators in setup_per_zone_pages_min()
to correct the calculation. Elaboration here:

originally the calculation was:

zone->pages_low = zone->pages_min + tmp / 4;
zone->pages_high = zone->pages_min + tmp / 2;

commit 622f7b4c920a9362d506400c0da02e3e06442b27 changed it to:

zone->pages_low = zone->pages_min + tmp >> 2;
zone->pages_high = zone->pages_min + tmp >> 1;

unfortunately the + operator has higher precedence than >> hence the

it should be:

zone->pages_low = zone->pages_min + (tmp >> 2);
zone->pages_high = zone->pages_min + (tmp >> 1);

Testcase: One can see the zonelist from /proc/zoneinfo: The low and high
water marks should be different between the buggy and fixed versions.


1. Install 6.0.6 LTS i386 Server in VirtualBox and
recording /proc/zoneinfo from /etc/rc.local to capture the zoneline low
and high settings at boot time. 
2. Booted up 3 times to see if the figures differ per boot (they
3. Installed the fixed kernel and repeated the 3 boot test
4. Compare the buggy and fixed /proc/zoneinfo logs, e.g:

        Buggy   Fixed
low      15     38
high     31     46

Attached: zone info logs for the two cases

** Attachment added: "/proc/zoneinfo for broken buggy version"

Precedence bug in patch
You received this bug notification because you are a member of Kernel
Bugs, which is subscribed to linux-source-2.6.15 in ubuntu.

More information about the kernel-bugs mailing list