debuggers.hg
changeset 3280:199e9c5ef609
bitkeeper revision 1.1159.187.54 (41af4acdZ4YHAyUW9HeJOhMYWMiB1g)
More ballon driver changes/fixes.
More ballon driver changes/fixes.
author | kaf24@scramble.cl.cam.ac.uk |
---|---|
date | Thu Dec 02 17:03:09 2004 +0000 (2004-12-02) |
parents | 0559e0d05589 |
children | 204dcd674164 150e98023e13 |
files | linux-2.6.9-xen-sparse/drivers/xen/balloon/balloon.c |
line diff
1.1 --- a/linux-2.6.9-xen-sparse/drivers/xen/balloon/balloon.c Thu Dec 02 16:40:33 2004 +0000 1.2 +++ b/linux-2.6.9-xen-sparse/drivers/xen/balloon/balloon.c Thu Dec 02 17:03:09 2004 +0000 1.3 @@ -161,6 +161,12 @@ static unsigned long current_target(void 1.4 return target; 1.5 } 1.6 1.7 +/* 1.8 + * We avoid multiple worker processes conflicting via the balloon mutex. 1.9 + * We may of course race updates of the target counts (which are protected 1.10 + * by the balloon lock), or with changes to the Xen hard limit, but we will 1.11 + * recover from these in time. 1.12 + */ 1.13 static void balloon_process(void *unused) 1.14 { 1.15 unsigned long *mfn_list, pfn, i, flags; 1.16 @@ -283,9 +289,10 @@ static void balloon_process(void *unused 1.17 /* Resets the Xen limit, sets new target, and kicks off processing. */ 1.18 static void set_new_target(unsigned long target) 1.19 { 1.20 + /* No need for lock. Not read-modify-write updates. */ 1.21 hard_limit = ~0UL; 1.22 target_pages = target; 1.23 - balloon_process(NULL); 1.24 + schedule_work(&balloon_worker); 1.25 } 1.26 1.27 static void balloon_ctrlif_rx(ctrl_msg_t *msg, unsigned long id) 1.28 @@ -426,8 +433,7 @@ static int __init balloon_init(void) 1.29 1.30 balloon_pde->proc_fops = &balloon_fops; 1.31 1.32 - (void)ctrl_if_register_receiver(CMSG_MEM_REQUEST, balloon_ctrlif_rx, 1.33 - CALLBACK_IN_BLOCKING_CONTEXT); 1.34 + (void)ctrl_if_register_receiver(CMSG_MEM_REQUEST, balloon_ctrlif_rx, 0); 1.35 1.36 /* Initialise the balloon with excess memory space. */ 1.37 for ( pfn = xen_start_info.nr_pages; pfn < max_pfn; pfn++ ) 1.38 @@ -446,7 +452,7 @@ void balloon_update_driver_allowance(lon 1.39 { 1.40 unsigned long flags; 1.41 balloon_lock(flags); 1.42 - driver_pages += delta; 1.43 + driver_pages += delta; /* non-atomic update */ 1.44 balloon_unlock(flags); 1.45 } 1.46 1.47 @@ -458,7 +464,7 @@ void balloon_put_pages(unsigned long *mf 1.48 if ( HYPERVISOR_dom_mem_op(MEMOP_decrease_reservation, 1.49 mfn_list, nr_mfns, 0) != nr_mfns ) 1.50 BUG(); 1.51 - current_pages -= nr_mfns; 1.52 + current_pages -= nr_mfns; /* non-atomic update */ 1.53 balloon_unlock(flags); 1.54 1.55 schedule_work(&balloon_worker);