aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/xen/balloon.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/xen/balloon.c')
-rw-r--r--drivers/xen/balloon.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c
index 9781e0dd59d6..d46839f51e73 100644
--- a/drivers/xen/balloon.c
+++ b/drivers/xen/balloon.c
@@ -151,6 +151,8 @@ static DECLARE_WAIT_QUEUE_HEAD(balloon_wq);
151static void balloon_process(struct work_struct *work); 151static void balloon_process(struct work_struct *work);
152static DECLARE_DELAYED_WORK(balloon_worker, balloon_process); 152static DECLARE_DELAYED_WORK(balloon_worker, balloon_process);
153 153
154static void release_memory_resource(struct resource *resource);
155
154/* When ballooning out (allocating memory to return to Xen) we don't really 156/* When ballooning out (allocating memory to return to Xen) we don't really
155 want the kernel to try too hard since that can trigger the oom killer. */ 157 want the kernel to try too hard since that can trigger the oom killer. */
156#define GFP_BALLOON \ 158#define GFP_BALLOON \
@@ -267,6 +269,20 @@ static struct resource *additional_memory_resource(phys_addr_t size)
267 return NULL; 269 return NULL;
268 } 270 }
269 271
272#ifdef CONFIG_SPARSEMEM
273 {
274 unsigned long limit = 1UL << (MAX_PHYSMEM_BITS - PAGE_SHIFT);
275 unsigned long pfn = res->start >> PAGE_SHIFT;
276
277 if (pfn > limit) {
278 pr_err("New System RAM resource outside addressable RAM (%lu > %lu)\n",
279 pfn, limit);
280 release_memory_resource(res);
281 return NULL;
282 }
283 }
284#endif
285
270 return res; 286 return res;
271} 287}
272 288