WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH][Take 3] Sysfs Interface for balloon driver

To: <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH][Take 3] Sysfs Interface for balloon driver
From: "Satoshi Uchida" <s-uchida@xxxxxxxxxxxxx>
Date: Mon, 2 Oct 2006 20:21:20 +0900
Cc: 'Ian Pratt' <m+Ian.Pratt@xxxxxxxxxxxx>
Delivery-date: Mon, 02 Oct 2006 04:22:09 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <3AAA99889D105740BE010EB6D5A5A3B202A3D3@xxxxxxxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Thread-index: AcbgmPYKO+6dSF7KTWykOVHhL8ByPQAAfPLAACfBAXAAF8OesAEeBGmw
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_kB is kept in 
/sys/devices/system/memory/memory0 as parameter,
and other information (ex. current_KB) 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

Attachment: balloon_sysfs.patch
Description: Binary data

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel