From: Daniel Kiper Subject: Re: [PATCH] [linux-2.6.39.x for xen] tmem: self-ballooning and frontswap-selfshrinking Date: Thu, 9 Jun 2011 19:21:57 +0200 Message-ID: <20110609172157.GA23592@router-fw-old.local.net-space.pl> References: <292df482-2d4c-4a4f-b5f4-4c808692156e@default> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: <292df482-2d4c-4a4f-b5f4-4c808692156e@default> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Dan Magenheimer Cc: jeremy@goop.org, xen-devel@lists.xensource.com, Dushmanta Mohapatra , JBeulich@novell.com, Konrad Wilk List-Id: xen-devel@lists.xenproject.org On Mon, Jun 06, 2011 at 03:12:28PM -0700, Dan Magenheimer wrote: [...] > +static void selfballoon_process(struct work_struct *work) > +{ > + extern unsigned long vm_get_committed_as(void); > + unsigned long cur_pages, goal_pages, tgt_pages; > + int reset_timer = 0; > + > + if (balloon_stats.selfballooning_enabled) { > + tgt_pages = cur_pages = totalram_pages; tgt_pages = cur_pages = balloon_stats.current_pages; > + goal_pages = vm_get_committed_as(); goal_pages = percpu_counter_read_positive(&vm_committed_as) + balloon_stats.current_pages - totalram_pages; > + if (cur_pages > goal_pages) > + tgt_pages = cur_pages - > + (cur_pages - goal_pages) / balloon_stats.selfballoon_downhysteresis; > + else if (cur_pages < goal_pages) > + tgt_pages = cur_pages + > + (goal_pages - cur_pages) / balloon_stats.selfballoon_uphysteresis; > + balloon_set_new_target(tgt_pages); > + reset_timer = 1; > + } > + if (frontswap_selfshrinking_enabled) { > + frontswap_selfshrink(); > + reset_timer = 1; > + } > + if (reset_timer) > + schedule_delayed_work(&selfballoon_worker, > + balloon_stats.selfballoon_interval * HZ); > +} Daniel