Skip to content

Commit 49b393a

Browse files
author
Peter Zijlstra
committed
perf: Add comment to enum perf_event_state
Better describe the event states. Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Reviewed-by: Leo Yan <[email protected]> Link: https://lkml.kernel.org/r/[email protected]
1 parent 3172fb9 commit 49b393a

File tree

1 file changed

+40
-2
lines changed

1 file changed

+40
-2
lines changed

include/linux/perf_event.h

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -635,8 +635,46 @@ struct perf_addr_filter_range {
635635
unsigned long size;
636636
};
637637

638-
/**
639-
* enum perf_event_state - the states of an event:
638+
/*
639+
* The normal states are:
640+
*
641+
* ACTIVE --.
642+
* ^ |
643+
* | |
644+
* sched_{in,out}() |
645+
* | |
646+
* v |
647+
* ,---> INACTIVE --+ <-.
648+
* | | |
649+
* | {dis,en}able()
650+
* sched_in() | |
651+
* | OFF <--' --+
652+
* | |
653+
* `---> ERROR ------'
654+
*
655+
* That is:
656+
*
657+
* sched_in: INACTIVE -> {ACTIVE,ERROR}
658+
* sched_out: ACTIVE -> INACTIVE
659+
* disable: {ACTIVE,INACTIVE} -> OFF
660+
* enable: {OFF,ERROR} -> INACTIVE
661+
*
662+
* Where {OFF,ERROR} are disabled states.
663+
*
664+
* Then we have the {EXIT,REVOKED,DEAD} states which are various shades of
665+
* defunct events:
666+
*
667+
* - EXIT means task that the even was assigned to died, but child events
668+
* still live, and further children can still be created. But the event
669+
* itself will never be active again. It can only transition to
670+
* {REVOKED,DEAD};
671+
*
672+
* - REVOKED means the PMU the event was associated with is gone; all
673+
* functionality is stopped but the event is still alive. Can only
674+
* transition to DEAD;
675+
*
676+
* - DEAD event really is DYING tearing down state and freeing bits.
677+
*
640678
*/
641679
enum perf_event_state {
642680
PERF_EVENT_STATE_DEAD = -5,

0 commit comments

Comments
 (0)