From: Dan Magenheimer Subject: RE: [PATCH] [linux-2.6.39.x for xen] tmem: self-ballooning and frontswap-selfshrinking Date: Thu, 9 Jun 2011 14:12:48 -0700 (PDT) Message-ID: <6713d588-a1a9-4673-8265-65a0f163fe2a@default> References: <292df482-2d4c-4a4f-b5f4-4c808692156e@default 20110609172157.GA23592@router-fw-old.local.net-space.pl> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Return-path: In-Reply-To: <20110609172157.GA23592@router-fw-old.local.net-space.pl> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Daniel Kiper Cc: jeremy@goop.org, xen-devel@lists.xensource.com, Konrad Wilk , JBeulich@novell.com, Ian Campbell , Dushmanta Mohapatra List-Id: xen-devel@lists.xenproject.org > From: Daniel Kiper [mailto:dkiper@net-space.pl] > Subject: Re: [Xen-devel] [PATCH] [linux-2.6.39.x for xen] tmem: self-ball= ooning and frontswap- > selfshrinking > goal_pages =3D percpu_counter_read_positive(&vm_committed_as) + !!! (Ian cc'ed) Thanks for catching this! I had thought vm_committed_as was not exported (and may not have been when I first coded this). Now that it is, the "core kernel" change that was part of the changeset is no longer required, thus removing the dependency on core kernel/mm review! Yay! > On Mon, Jun 06, 2011 at 03:12:28PM -0700, Dan Magenheimer wrote: >=20 > [...] >=20 > > +static void selfballoon_process(struct work_struct *work) > > +{ > > +=09extern unsigned long vm_get_committed_as(void); > > +=09unsigned long cur_pages, goal_pages, tgt_pages; > > +=09int reset_timer =3D 0; > > + > > +=09if (balloon_stats.selfballooning_enabled) { > > +=09=09tgt_pages =3D cur_pages =3D totalram_pages; >=20 > tgt_pages =3D cur_pages =3D balloon_stats.current_pages; >=20 > > +=09=09goal_pages =3D vm_get_committed_as(); >=20 > goal_pages =3D percpu_counter_read_positive(&vm_committed_as) + > =09=09balloon_stats.current_pages - totalram_pages; >=20 > > +=09=09if (cur_pages > goal_pages) > > +=09=09=09tgt_pages =3D cur_pages - > > +=09=09=09=09(cur_pages - goal_pages) / balloon_stats.selfballoon_downh= ysteresis; > > +=09=09else if (cur_pages < goal_pages) > > +=09=09=09tgt_pages =3D cur_pages + > > +=09=09=09=09(goal_pages - cur_pages) / balloon_stats.selfballoon_uphys= teresis; > > +=09=09balloon_set_new_target(tgt_pages); > > +=09=09reset_timer =3D 1; > > +=09} > > +=09if (frontswap_selfshrinking_enabled) { > > +=09=09frontswap_selfshrink(); > > +=09=09reset_timer =3D 1; > > +=09} > > +=09if (reset_timer) > > +=09=09schedule_delayed_work(&selfballoon_worker, > > +=09=09=09balloon_stats.selfballoon_interval * HZ); > > +} Thanks for the review Daniel! Do these changes make it compatible with your hotplug work? In your second correction (goal_pages), is it possible that balloon_stats.current_pages is less then totalram_pages? If so, then goal_pages is less than vm_committed_as, which I don't think is ever intended. Thanks, Dan