Satoshi Uchida
2006-Oct-20 10:32 UTC
[Xen-devel] [PATCH][Take 3-2][Resend] Sysfs Interface for balloon driver
This mail is resend mail. But, the units is modified by result of discussion. The attached patch is final version. Have anyone comments? Hi. This patch provides a sysfs interface for the balloon driver (Take 3). Currently, the interface for the balloon driver is provided by procfs. However, I was suggested by Kier and Anthony that procfs should handle only process information and other information should be located in sysfs, when I made the interface for virtual block devices. The information for the balloon driver also should be moved to sysfs. So, I have made a sysfs interface for the balloon driver. The information for balloon driver is placed in /sys/devices/system/memory/. For Take 2 patch, this patch modifies only target_kibi_bytes is kept in /sys/devices/system/memory/memory0 as parameter, and other information (ex. current_kibi_bytes) is moved to info sub directory. The hard limit is remained for the present. Perhaps, anyone maybe used at someday, and it may be useful now. Example outputs of the sysfs interface of the balloon driver are as follows: Example 1. Show each information [root@Dom0 ~]# ls -al /sys/devices/system/memory/memory0/ total 0 drwxr-xr-x 3 root root 0 Oct 2 20:13 . drwxr-xr-x 3 root root 0 Oct 3 2006 .. drwxr-xr-x 2 root root 0 Oct 2 20:11 info -rw-r--r-- 1 root root 4096 Oct 2 20:13 target_kB [root@Dom0 ~]# cat /sys/devices/system/memory/memory0/target_kB 262144 [root@noir ~]# ls -al /sys/devices/system/memory/memory0/info/ total 0 drwxr-xr-x 2 root root 0 Oct 2 20:11 . drwxr-xr-x 3 root root 0 Oct 2 20:13 .. -r--r--r-- 1 root root 4096 Oct 2 20:14 current_kB -r--r--r-- 1 root root 4096 Oct 2 20:14 driver_kB -r--r--r-- 1 root root 4096 Oct 2 20:14 hard_limit_kB -r--r--r-- 1 root root 4096 Oct 2 20:14 high_kB -r--r--r-- 1 root root 4096 Oct 2 20:14 low_kB [root@Dom0 ~]# cat /sys/devices/system/memory/memory0/info/current_kB 262144 [root@Dom0 ~]# cat /sys/devices/system/memory/memory0/info/driver_kB 1024 [root@Dom0 ~]# cat /sys/devices/system/memory/memory0/info/hard_limit_kB ??? [root@Dom0 ~]# cat /sys/devices/system/memory/memory0/info/high_kB 0 [root@Dom0 ~]# cat /sys/devices/system/memory/memory0/info/low_kB 509952 Example 2. Set memory size of a domain [root@Dom0 ~]# echo 1024M > /sys/devices/system/memory/memory0/target_kB [root@Dom0 ~]# cat /sys/devices/system/memory/memory0/target_kB 1048576 [root@Dom0 ~]# cat /sys/devices/system/memory/memory0/info/current_kB 758192 [root@Dom0 ~]# cat /sys/devices/system/memory/memory0/info/hard_limit_kB 758192 [root@Dom0 ~]# cat /sys/devices/system/memory/memory0/info/driver_kB 1024 Regards Satoshi UCHIDA NEC Corporation, Japan _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Keir Fraser
2006-Oct-20 19:17 UTC
Re: [Xen-devel] [PATCH][Take 3-2][Resend] Sysfs Interface for balloon driver
On 20/10/06 11:32 am, "Satoshi Uchida" <s-uchida@ap.jp.nec.com> wrote:> This mail is resend mail. > But, the units is modified by result of discussion. > The attached patch is final version. > > Have anyone comments?I don''t remember the precise details of the debate about the sysfs names, but <foo>_kibi_bytes isn''t going to get checked in. I hate that stupid naming scheme, especially where noone is likely to get confused between whether 10^3 and 2^10 is meant. And the suffix is rather long too: it dwarfs the interesting bit of the name. Can I just ''s/kibi_bytes/kb/g'' when I check this in? Noone''s going to get confused that it''s units of 10^3-bits or 10^3-bytes or 2^10-bits. -- Keir _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
John Levon
2006-Oct-20 19:41 UTC
Re: [Xen-devel] [PATCH][Take 3-2][Resend] Sysfs Interface for balloon driver
On Fri, Oct 20, 2006 at 08:17:03PM +0100, Keir Fraser wrote:> I don''t remember the precise details of the debate about the sysfs names, > but <foo>_kibi_bytes isn''t going to get checked in. I hate that stupid > naming scheme, especially where noone is likely to get confused between > whether 10^3 and 2^10 is meant. And the suffix is rather long too: it dwarfs > the interesting bit of the name. > > Can I just ''s/kibi_bytes/kb/g'' when I check this in? Noone''s going to get > confused that it''s units of 10^3-bits or 10^3-bytes or 2^10-bits.Please! This is what I was asking for... regards john _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Satoshi Uchida
2006-Oct-24 06:01 UTC
RE: [Xen-devel] [PATCH][Take 3-2][Resend] Sysfs Interface for balloon driver
> > Can I just ''s/kibi_bytes/kb/g'' when I check this in? Noone''s > going to get confused that it''s units of 10^3-bits or > 10^3-bytes or 2^10-bits. >No problem. I think that ''s/kibi_bytes/kib/g'' may be also fine. The most important one is to be able to take information. Next, it is important that anyone can understand easily and clearly. We discussed which representations is more better. However, there are many representation in the field and there are traditional representation in each field. Ex. If based on formal, it should represented at ''KiB'' (kilo binary bytes). In xenmon, this representation is also used. (ex.MiB) However, traditional representation is ''kb'' in sysfs (block and memory field) and no computer engineers is going to mistake as you say. I can not decided that which formal or traditional representation is better. Thanks, Satoshi UCHIDA _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel