Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754175Ab1CKXFK (ORCPT ); Fri, 11 Mar 2011 18:05:10 -0500 Received: from jaguar.mail.utk.edu ([160.36.0.84]:55374 "EHLO jaguar.mail.utk.edu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751868Ab1CKXFI (ORCPT ); Fri, 11 Mar 2011 18:05:08 -0500 X-Greylist: delayed 609 seconds by postgrey-1.27 at vger.kernel.org; Fri, 11 Mar 2011 18:05:07 EST Date: Fri, 11 Mar 2011 17:54:17 -0500 (EST) From: Vince Weaver To: linux-kernel@vger.kernel.org cc: Peter Zijlstra , Paul Mackerras , Ingo Molnar , Arnaldo Carvalho de Melo Subject: perf: kernel memory leak when inherit enabled Message-ID: User-Agent: Alpine 2.00 (DEB 1167 2008-08-23) MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="8323329-1883999057-1299884058=:15818" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3936 Lines: 82 This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --8323329-1883999057-1299884058=:15818 Content-Type: TEXT/PLAIN; charset=US-ASCII Hello While trying to use perf events with inherit enabled to profile some multi-threaded BLAS routines (using PAPI) I ended up out-of-memorying my machine. It turns out you can quickly leak gigabytes of kernel memory that isn't freed when the process exits. I've attached a test case that reproduces this. It leaks on 2.6.37 and 2.6.35.9. It does not on 2.6.32. I would like to try on current git and maybe even bisect, but my devel machine currently is broken with the ".size expression does not evaluate to a constant" binutils nonsense. Unfortunately I won't have much chance to test any more until Monday, but I thought I'd send this in case it's something obvious that can be easily reproduced and fixed. Thanks, Vince vweaver1@eecs.utk.edu --8323329-1883999057-1299884058=:15818 Content-Type: TEXT/x-csrc; name=pe_inherit_memleak.c Content-Transfer-Encoding: BASE64 Content-ID: Content-Description: Content-Disposition: attachment; filename=pe_inherit_memleak.c LyogcGVf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AgICAg IH0NCiAgICAgIA0KICAgICAgZm9yKGo9MDtqPDg7aisrKSB7DQogICAgICAg ICBwdGhyZWFkX2pvaW4ob3VyX3RocmVhZFtqXSxOVUxMKTsJIA0KICAgICAg fQ0KICAgICAgDQogICB9DQogICANCiAgIHJldHVybiAwOw0KfQ0K --8323329-1883999057-1299884058=:15818-- -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/