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.c41
1 files changed, 40 insertions, 1 deletions
diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c
index 8dc7109d61b7..efa4b363ce72 100644
--- a/drivers/xen/balloon.c
+++ b/drivers/xen/balloon.c
@@ -298,6 +298,14 @@ static int decrease_reservation(unsigned long nr_pages)
298 frame_list[i] = pfn_to_mfn(pfn); 298 frame_list[i] = pfn_to_mfn(pfn);
299 299
300 scrub_page(page); 300 scrub_page(page);
301
302 if (!PageHighMem(page)) {
303 ret = HYPERVISOR_update_va_mapping(
304 (unsigned long)__va(pfn << PAGE_SHIFT),
305 __pte_ma(0), 0);
306 BUG_ON(ret);
307 }
308
301 } 309 }
302 310
303 /* Ensure that ballooned highmem pages don't have kmaps. */ 311 /* Ensure that ballooned highmem pages don't have kmaps. */
@@ -490,7 +498,7 @@ static ssize_t store_target_kb(struct sys_device *dev,
490 if (!capable(CAP_SYS_ADMIN)) 498 if (!capable(CAP_SYS_ADMIN))
491 return -EPERM; 499 return -EPERM;
492 500
493 target_bytes = memparse(buf, &endchar); 501 target_bytes = simple_strtoull(buf, &endchar, 0) * 1024;
494 502
495 balloon_set_new_target(target_bytes >> PAGE_SHIFT); 503 balloon_set_new_target(target_bytes >> PAGE_SHIFT);
496 504
@@ -500,8 +508,39 @@ static ssize_t store_target_kb(struct sys_device *dev,
500static SYSDEV_ATTR(target_kb, S_IRUGO | S_IWUSR, 508static SYSDEV_ATTR(target_kb, S_IRUGO | S_IWUSR,
501 show_target_kb, store_target_kb); 509 show_target_kb, store_target_kb);
502 510
511
512static ssize_t show_target(struct sys_device *dev, struct sysdev_attribute *attr,
513 char *buf)
514{
515 return sprintf(buf, "%llu\n",
516 (u64)balloon_stats.target_pages << PAGE_SHIFT);
517}
518
519static ssize_t store_target(struct sys_device *dev,
520 struct sysdev_attribute *attr,
521 const char *buf,
522 size_t count)
523{
524 char *endchar;
525 unsigned long long target_bytes;
526
527 if (!capable(CAP_SYS_ADMIN))
528 return -EPERM;
529
530 target_bytes = memparse(buf, &endchar);
531
532 balloon_set_new_target(target_bytes >> PAGE_SHIFT);
533
534 return count;
535}
536
537static SYSDEV_ATTR(target, S_IRUGO | S_IWUSR,
538 show_target, store_target);
539
540
503static struct sysdev_attribute *balloon_attrs[] = { 541static struct sysdev_attribute *balloon_attrs[] = {
504 &attr_target_kb, 542 &attr_target_kb,
543 &attr_target,
505}; 544};
506 545
507static struct attribute *balloon_info_attrs[] = { 546static struct attribute *balloon_info_attrs[] = {