From: Dan Magenheimer Subject: RE: 2.6.28 and balloon driver Date: Wed, 7 Jan 2009 18:00:10 +0000 (GMT) Message-ID: <644954d7-ab1d-4b1c-94d8-c2c01bc1fb1c@default> References: <18788.38131.316953.781779@mariner.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset=Windows-1252 Content-Transfer-Encoding: quoted-printable Return-path: In-Reply-To: <18788.38131.316953.781779@mariner.uk.xensource.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Ian Jackson , Ian Campbell Cc: Jeremy Fitzhardinge , "Xen-Devel (E-mail)" List-Id: xen-devel@lists.xenproject.org > Since you're changing the name anyway, can't we change the users of > the file to understand the new units too ? The patch should be easy, it's the change to backwards compatibility that should be discussed, both for xen distros and now for upstream Linux as well. I suspect this isn't used much (yet) but don't know. Writing bytes to a sysfs entry called target_kb is a bug I think. Is there precedence for having one sysfs entry for reading and another for writing (the same value)? >> 2) There is no "safety minimum", so writing the same value back >> actually reduces memory by a factor of 1024! > I guess this just needs porting forward. I vaguely recalled and so went and found this post from Jeremy: http://lists.xensource.com/archives/html/xen-devel/2008-04/msg00144.html (so Jeremy cc'ed) So is it better to have the existing static model, or none at all, or discuss and implement something better? One option might be to have a writable sysfs min-mem which defaults to the computed-from-maxmem value (from Jan's patch) but can be overridden**. That way, just changing target won't accidentally cause OOMs but more aggressive ballooning can also be done. Dan ** and bytes? kb? mb? :-) > -----Original Message----- > From: Ian Jackson [mailto:Ian.Jackson@eu.citrix.com] > Sent: Wednesday, January 07, 2009 4:42 AM > To: Ian Campbell > Cc: Dan Magenheimer; Xen-Devel (E-mail) > Subject: Re: [Xen-devel] 2.6.28 and balloon driver >=20 >=20 > Ian Campbell writes ("Re: [Xen-devel] 2.6.28 and balloon driver"): > > Looks like the write function uses memparse which=20 > understands the M, K > > etc suffixes and defaults to bytes. The ability to say=20 > balloon to M > > is quite nice but for the sake of consistency with the name it's > > probably preferable to just treat the value as a number of Kbytes. >=20 > Since you're changing the name anyway, can't we change the users of > the file to understand the new units too ? >=20 > Ie, I think we should have > /sys/devices/system/xen_memory/xen_memory0/targe > which when read produces a number of bytes and which uses the default > memparse function. If nothing else this is more likely to be > something upstream mind less. >=20 > Ian. >=20 On Tue, 2009-01-06 at 23:34 +0000, Dan Magenheimer wrote: > I am playing with 2.6.28 on xen. Nice! Thanks Jeremy! >=20 > But I have a minor gripe... >=20 > The balloon driver now is accessed via a sysfs file, for example: >=20 > # SIZE=3D`cat /sys/devices/system/xen_memory/xen_memory0/target_kb` > # echo $SIZE > # echo $SIZE > /sys/devices/system/xen_memory/xen_memory0/target_kb >=20 > SIZE does indeed get current memory size in kbytes, but > if one tries to pass SIZE (or slightly smaller value) back, > all hell breaks loose because: >=20 > 1) Despite the name, the value written must be in bytes, not kbytes Looks like the write function uses memparse which understands the M, K etc suffixes and defaults to bytes. The ability to say balloon to M is quite nice but for the sake of consistency with the name it's probably preferable to just treat the value as a number of Kbytes. > 2) There is no "safety minimum", so writing the same value back > actually reduces memory by a factor of 1024! I guess this just needs porting forward. Can you provide patches for both these issues? Ian. >=20 > I realize behavior (1) is backwards-compatible with the existing > /proc/xen/balloon behavior, but at least that filename doesn't > imply a unit size. >=20 > For (2), as sysadmins grow comfortable with the "safety minimum" > that's been implemented in upstream xen now for nearly a year, > (users can do: >=20 > # echo 0 > /proc/xen/balloon >=20 > and it still works), some people upgrading to a 2.6.28 kernel > are in for a nasty surprise. >=20 >