aboutsummaryrefslogtreecommitdiff
path: root/arch/ia64/kernel/setup.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-01-06 18:02:43 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2012-01-06 18:02:43 -0800
commit5ee354a0295c34aa7da07be8490f86edee2c7883 (patch)
tree9ceeba4179d48f0ca7b31a4d2b5a7f1d60df5ecb /arch/ia64/kernel/setup.c
parentc77417132c12af338a7d37956809b2b98d20413c (diff)
parenta4b1d1b3619ee2fac40cdf5ca86a4758e45b9358 (diff)
Merge branch 'misc-3.3' of git://git.kernel.org/pub/scm/linux/kernel/git/aegl/linux
* 'misc-3.3' of git://git.kernel.org/pub/scm/linux/kernel/git/aegl/linux: ia64: pcibr: Use kmemdup rather than duplicating its implementation ia64: sn: Use kmemdup rather than duplicating its implementation ia64: tioca: Use kmemdup rather than duplicating its implementation [IA64] Merge overlapping reserved regions at boot
Diffstat (limited to 'arch/ia64/kernel/setup.c')
-rw-r--r--arch/ia64/kernel/setup.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/arch/ia64/kernel/setup.c b/arch/ia64/kernel/setup.c
index 5e2c72498c5..cd57d7312de 100644
--- a/arch/ia64/kernel/setup.c
+++ b/arch/ia64/kernel/setup.c
@@ -220,6 +220,23 @@ sort_regions (struct rsvd_region *rsvd_region, int max)
}
}
+/* merge overlaps */
+static int __init
+merge_regions (struct rsvd_region *rsvd_region, int max)
+{
+ int i;
+ for (i = 1; i < max; ++i) {
+ if (rsvd_region[i].start >= rsvd_region[i-1].end)
+ continue;
+ if (rsvd_region[i].end > rsvd_region[i-1].end)
+ rsvd_region[i-1].end = rsvd_region[i].end;
+ --max;
+ memmove(&rsvd_region[i], &rsvd_region[i+1],
+ (max - i) * sizeof(struct rsvd_region));
+ }
+ return max;
+}
+
/*
* Request address space for all standard resources
*/
@@ -270,6 +287,7 @@ static void __init setup_crashkernel(unsigned long total, int *n)
if (ret == 0 && size > 0) {
if (!base) {
sort_regions(rsvd_region, *n);
+ *n = merge_regions(rsvd_region, *n);
base = kdump_find_rsvd_region(size,
rsvd_region, *n);
}
@@ -373,6 +391,7 @@ reserve_memory (void)
BUG_ON(IA64_MAX_RSVD_REGIONS + 1 < n);
sort_regions(rsvd_region, num_rsvd_regions);
+ num_rsvd_regions = merge_regions(rsvd_region, num_rsvd_regions);
}