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]Fix memory leak for copy-receiver of netfront

To: xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH]Fix memory leak for copy-receiver of netfront
From: Kasai Takanori <kasai.takanori@xxxxxxxxxxxxxx>
Date: Wed, 11 Jun 2008 15:03:14 +0900
Delivery-date: Tue, 10 Jun 2008 23:03:48 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
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
Hi all,

We found the problem of the memory leak when working with copy-
receiver of netfront.

The source of a problem is that the fragment page is not released with 
dev_kfree_skb() because the nr_frags variable of skb is set to 0. 

This is the patch to fix memory leak in netfront.

Signed-off-by: Kazuhiro Suzuki <kaz@xxxxxxxxxxxxxx>
Signed-off-by: Hirofumi Tsujimura <tsujimura.hirof@xxxxxxxxxxxxxx>
Signed-off-by: Takanori Kasai <kasai.takanori@xxxxxxxxxxxxxx>


A guest kernel does panic if attaching and detaching VNIF is repeated.
Because guest memory becomes empty, and OOM killer is run.
It is a log of that time as follows. 

------------------------------------------------------------------------
<dom0 log>
# xm network-attach guest
# xm network-detach guest 0
# xm network-attach guest
# xm network-detach guest 1
... repeat ...
# xm network-attach guest
# xm network-detach guest 179
# xm network-attach guest
# xm network-detach guest 180
Error: Domain 'guest' does not exist.


<guest log>
# free -m
             total       used       free     shared    buffers     
cached
Mem:           512        504          8          0         23        
174
-/+ buffers/cache:        305        206
Swap:          511          0        511
... repeat ...
# free -m
             total       used       free     shared    buffers     
cached
Mem:           512        509          2          0          0          
1
-/+ buffers/cache:        507          4
Swap:          511         50        461
awk invoked oom-killer: gfp_mask=0x201d2, order=0, oomkilladj=-17

Call Trace:
 [<a00000010001d160>] show_stack+0x40/0xa0
                                sp=e00000001e0a7a70 bsp=e00000001e0a1480
 [<a00000010001d1f0>] dump_stack+0x30/0x60
                                sp=e00000001e0a7c40 bsp=e00000001e0a1468
 [<a00000010011b1b0>] out_of_memory+0xf0/0x780
                                sp=e00000001e0a7c40 bsp=e00000001e0a1430
 [<a000000100121040>] __alloc_pages+0x420/0x540
                                sp=e00000001e0a7cd0 bsp=e00000001e0a13b8
... snip ...
Kernel panic - not syncing: Out of memory and no killable processes...
------------------------------------------------------------------------

Best Regards,

---
Takanori Kasai

Attachment: fix-netfront-memory-leak.patch
Description: Binary data

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>