/[linux-patches]/genpatches-2.6/trunk/2.6.12-pre/1900_lowmem-reserve-oops.patch
Gentoo

Contents of /genpatches-2.6/trunk/2.6.12-pre/1900_lowmem-reserve-oops.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4 - (show annotations) (download) (as text)
Sat Jun 11 23:20:41 2005 UTC (15 years, 5 months ago) by dsd
File MIME type: text/x-diff
File size: 2788 byte(s)
Create 2.6.12 branch
1
2
3 If you do 'echo 0 0 > /proc/sys/vm/lowmem_reserve_ratio' the kernel gets a
4 divide-by-zero.
5
6 Prevent that, and fiddle with some whitespace too.
7
8 Signed-off-by: Andrew Morton <akpm@osdl.org>
9 ---
10
11 25-akpm/mm/page_alloc.c | 21 +++++++++++++++------
12 1 files changed, 15 insertions(+), 6 deletions(-)
13
14 diff -puN mm/page_alloc.c~setup_per_zone_lowmem_reserve-oops-fix mm/page_alloc.c
15 --- 25/mm/page_alloc.c~setup_per_zone_lowmem_reserve-oops-fix 2005-03-01 00:13:57.000000000 -0800
16 +++ 25-akpm/mm/page_alloc.c 2005-03-01 00:13:57.000000000 -0800
17 @@ -37,13 +37,17 @@
18 #include <asm/tlbflush.h>
19 #include "internal.h"
20
21 -/* MCD - HACK: Find somewhere to initialize this EARLY, or make this initializer cleaner */
22 +/*
23 + * MCD - HACK: Find somewhere to initialize this EARLY, or make this
24 + * initializer cleaner
25 + */
26 nodemask_t node_online_map = { { [0] = 1UL } };
27 nodemask_t node_possible_map = NODE_MASK_ALL;
28 struct pglist_data *pgdat_list;
29 unsigned long totalram_pages;
30 unsigned long totalhigh_pages;
31 long nr_swap_pages;
32 +
33 /*
34 * results with 256, 32 in the lowmem_reserve sysctl:
35 * 1G machine -> (16M dma, 800M-16M normal, 1G-800M high)
36 @@ -1924,15 +1928,20 @@ static void setup_per_zone_lowmem_reserv
37
38 for_each_pgdat(pgdat) {
39 for (j = 0; j < MAX_NR_ZONES; j++) {
40 - struct zone * zone = pgdat->node_zones + j;
41 + struct zone *zone = pgdat->node_zones + j;
42 unsigned long present_pages = zone->present_pages;
43
44 zone->lowmem_reserve[j] = 0;
45
46 for (idx = j-1; idx >= 0; idx--) {
47 - struct zone * lower_zone = pgdat->node_zones + idx;
48 + struct zone *lower_zone;
49 +
50 + if (sysctl_lowmem_reserve_ratio[idx] < 1)
51 + sysctl_lowmem_reserve_ratio[idx] = 1;
52
53 - lower_zone->lowmem_reserve[j] = present_pages / sysctl_lowmem_reserve_ratio[idx];
54 + lower_zone = pgdat->node_zones + idx;
55 + lower_zone->lowmem_reserve[j] = present_pages /
56 + sysctl_lowmem_reserve_ratio[idx];
57 present_pages += lower_zone->present_pages;
58 }
59 }
60 @@ -2039,7 +2048,7 @@ module_init(init_per_zone_pages_min)
61 * changes.
62 */
63 int min_free_kbytes_sysctl_handler(ctl_table *table, int write,
64 - struct file *file, void __user *buffer, size_t *length, loff_t *ppos)
65 + struct file *file, void __user *buffer, size_t *length, loff_t *ppos)
66 {
67 proc_dointvec(table, write, file, buffer, length, ppos);
68 setup_per_zone_pages_min();
69 @@ -2056,7 +2065,7 @@ int min_free_kbytes_sysctl_handler(ctl_t
70 * if in function of the boot time zone sizes.
71 */
72 int lowmem_reserve_ratio_sysctl_handler(ctl_table *table, int write,
73 - struct file *file, void __user *buffer, size_t *length, loff_t *ppos)
74 + struct file *file, void __user *buffer, size_t *length, loff_t *ppos)
75 {
76 proc_dointvec_minmax(table, write, file, buffer, length, ppos);
77 setup_per_zone_lowmem_reserve();
78 _

  ViewVC Help
Powered by ViewVC 1.1.20