lkml.org 
[lkml]   [2009]   [May]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 3/5] perf_counter: rework ioctl()s
Paul Mackerras wrote:
> Corey Ashford writes:
>
>> Another hypothesis is that the old PAPI code would open, mmap, close,
>> then reopen, and mmap again. I wonder if because I wasn't munmap'ing
>> before the close, that I got some strange behavior from the kernel.
>
> In general an mmap will keep a reference to the file it is mapping,
> which means that if you do an mmap on a fd and then close the fd, the
> file stays open until the region is munmapped. So your old PAPI code
> would have ended up with more counters active than you expected, if
> you thought closing the fd would have destroyed the counter.
>
> That is, you don't have to munmap before close, but you do have to do
> both close and munmap to destroy the counter.


That makes perfect sense. I'll bet that's what the problem was. I think this
issue can be closed. Thank you Paul M. and Peter Z. for looking into this.

- Corey



\
 
 \ /
  Last update: 2009-05-13 00:55    [from the cache]
©2003-2011 Jasper Spaans