perf_counter: fix perf_poll()

Impact: fix kerneltop 100% CPU usage

Only return a poll event when there's actually been one, poll_wait()
doesn't actually wait for the waitq you pass it, it only enqueues
you on it.

Only once all FDs have been iterated and none of thm returned a
poll-event will it schedule().

Also make it return POLL_HUP when there's not mmap() area to read from.

Further, fix a silly bug in the write code.

Reported-by: Mike Galbraith <efault@gmx.de>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arjan van de Ven <arjan@infradead.org>
Orig-LKML-Reference: <1237897096.24918.181.camel@twins>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
This commit is contained in:
Peter Zijlstra
2009-03-24 13:18:16 +01:00
committed by Ingo Molnar
parent f66c6b2066
commit c7138f37f9
2 changed files with 13 additions and 2 deletions

View File

@@ -246,6 +246,7 @@ struct file;
struct perf_mmap_data {
struct rcu_head rcu_head;
int nr_pages;
atomic_t wakeup;
atomic_t head;
struct perf_counter_mmap_page *user_page;
void *data_pages[0];