[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <4A09FD81.8090805@linux.vnet.ibm.com>
Date: Tue, 12 May 2009 15:51:45 -0700
From: Corey Ashford <cjashfor@...ux.vnet.ibm.com>
To: Paul Mackerras <paulus@...ba.org>
CC: Peter Zijlstra <a.p.zijlstra@...llo.nl>,
Ingo Molnar <mingo@...e.hu>, linux-kernel@...r.kernel.org,
Thomas Gleixner <tglx@...utronix.de>
Subject: Re: [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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists