]>
Commit | Line | Data |
---|---|---|
7425a565 GKH |
1 | From cea27eb2a202959783f81254c48c250ddd80e129 Mon Sep 17 00:00:00 2001 |
2 | From: Wanpeng Li <liwanp@linux.vnet.ibm.com> | |
3 | Date: Wed, 3 Jul 2013 15:02:40 -0700 | |
4 | Subject: mm/memory-hotplug: fix lowmem count overflow when offline pages | |
5 | ||
6 | From: Wanpeng Li <liwanp@linux.vnet.ibm.com> | |
7 | ||
8 | commit cea27eb2a202959783f81254c48c250ddd80e129 upstream. | |
9 | ||
10 | The logic for the memory-remove code fails to correctly account the | |
11 | Total High Memory when a memory block which contains High Memory is | |
12 | offlined as shown in the example below. The following patch fixes it. | |
13 | ||
14 | Before logic memory remove: | |
15 | ||
16 | MemTotal: 7603740 kB | |
17 | MemFree: 6329612 kB | |
18 | Buffers: 94352 kB | |
19 | Cached: 872008 kB | |
20 | SwapCached: 0 kB | |
21 | Active: 626932 kB | |
22 | Inactive: 519216 kB | |
23 | Active(anon): 180776 kB | |
24 | Inactive(anon): 222944 kB | |
25 | Active(file): 446156 kB | |
26 | Inactive(file): 296272 kB | |
27 | Unevictable: 0 kB | |
28 | Mlocked: 0 kB | |
29 | HighTotal: 7294672 kB | |
30 | HighFree: 5704696 kB | |
31 | LowTotal: 309068 kB | |
32 | LowFree: 624916 kB | |
33 | ||
34 | After logic memory remove: | |
35 | ||
36 | MemTotal: 7079452 kB | |
37 | MemFree: 5805976 kB | |
38 | Buffers: 94372 kB | |
39 | Cached: 872000 kB | |
40 | SwapCached: 0 kB | |
41 | Active: 626936 kB | |
42 | Inactive: 519236 kB | |
43 | Active(anon): 180780 kB | |
44 | Inactive(anon): 222944 kB | |
45 | Active(file): 446156 kB | |
46 | Inactive(file): 296292 kB | |
47 | Unevictable: 0 kB | |
48 | Mlocked: 0 kB | |
49 | HighTotal: 7294672 kB | |
50 | HighFree: 5181024 kB | |
51 | LowTotal: 4294752076 kB | |
52 | LowFree: 624952 kB | |
53 | ||
54 | [mhocko@suse.cz: fix CONFIG_HIGHMEM=n build] | |
55 | Signed-off-by: Wanpeng Li <liwanp@linux.vnet.ibm.com> | |
56 | Reviewed-by: Michal Hocko <mhocko@suse.cz> | |
57 | Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> | |
58 | Cc: David Rientjes <rientjes@google.com> | |
59 | Cc: <stable@vger.kernel.org> [2.6.24+] | |
60 | Signed-off-by: Andrew Morton <akpm@linux-foundation.org> | |
61 | Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> | |
62 | Signed-off-by: Zhouping Liu <zliu@redhat.com> | |
63 | Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | |
64 | ||
65 | --- | |
66 | mm/page_alloc.c | 4 ++++ | |
67 | 1 file changed, 4 insertions(+) | |
68 | ||
69 | --- a/mm/page_alloc.c | |
70 | +++ b/mm/page_alloc.c | |
71 | @@ -5592,6 +5592,10 @@ __offline_isolated_pages(unsigned long s | |
72 | zone->free_area[order].nr_free--; | |
73 | __mod_zone_page_state(zone, NR_FREE_PAGES, | |
74 | - (1UL << order)); | |
75 | +#ifdef CONFIG_HIGHMEM | |
76 | + if (PageHighMem(page)) | |
77 | + totalhigh_pages -= 1 << order; | |
78 | +#endif | |
79 | for (i = 0; i < (1 << order); i++) | |
80 | SetPageReserved((page+i)); | |
81 | pfn += (1 << order); |