Commit bdafb4d
committed
tracing: Remove get_trigger_ops() and add count_func() from trigger ops
The struct event_command has a callback function called get_trigger_ops().
This callback returns the "trigger_ops" to use for the trigger. These ops
define the trigger function, how to init the trigger, how to print the
trigger and how to free it.
The only reason there's a callback function to get these ops is because
some triggers have two types of operations. One is an "always on"
operation, and the other is a "count down" operation. If a user passes in
a parameter to say how many times the trigger should execute. For example:
echo stacktrace:5 > events/kmem/kmem_cache_alloc/trigger
It will trigger the stacktrace for the first 5 times the kmem_cache_alloc
event is hit.
Instead of having two different trigger_ops since the only difference
between them is the tigger itself (the print, init and free functions are
all the same), just use a single ops that the event_command points to and
add a function field to the trigger_ops to have a count_func.
When a trigger is added to an event, if there's a count attached to it and
the trigger ops has the count_func field, the data allocated to represent
this trigger will have a new flag set called COUNT.
Then when the trigger executes, it will check if the COUNT data flag is
set, and if so, it will call the ops count_func(). If that returns false,
it returns without executing the trigger.
This removes the need for duplicate event_trigger_ops structures.
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Link: https://patch.msgid.link/20251125200932.274566147@kernel.org
Reviewed-by: Tom Zanussi <zanussi@kernel.org>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>1 parent 23c0e9c commit bdafb4d
4 files changed
Lines changed: 116 additions & 235 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1791 | 1791 | | |
1792 | 1792 | | |
1793 | 1793 | | |
| 1794 | + | |
1794 | 1795 | | |
1795 | 1796 | | |
1796 | 1797 | | |
| |||
1822 | 1823 | | |
1823 | 1824 | | |
1824 | 1825 | | |
| 1826 | + | |
| 1827 | + | |
| 1828 | + | |
| 1829 | + | |
1825 | 1830 | | |
1826 | 1831 | | |
1827 | 1832 | | |
| |||
1909 | 1914 | | |
1910 | 1915 | | |
1911 | 1916 | | |
| 1917 | + | |
| 1918 | + | |
| 1919 | + | |
| 1920 | + | |
| 1921 | + | |
1912 | 1922 | | |
1913 | 1923 | | |
1914 | 1924 | | |
| |||
1936 | 1946 | | |
1937 | 1947 | | |
1938 | 1948 | | |
| 1949 | + | |
| 1950 | + | |
| 1951 | + | |
| 1952 | + | |
1939 | 1953 | | |
1940 | 1954 | | |
1941 | 1955 | | |
| |||
1962 | 1976 | | |
1963 | 1977 | | |
1964 | 1978 | | |
| 1979 | + | |
| 1980 | + | |
| 1981 | + | |
1965 | 1982 | | |
1966 | 1983 | | |
1967 | 1984 | | |
| |||
2013 | 2030 | | |
2014 | 2031 | | |
2015 | 2032 | | |
2016 | | - | |
2017 | | - | |
2018 | | - | |
2019 | | - | |
2020 | | - | |
2021 | | - | |
2022 | | - | |
2023 | 2033 | | |
2024 | 2034 | | |
2025 | 2035 | | |
2026 | 2036 | | |
| 2037 | + | |
2027 | 2038 | | |
2028 | 2039 | | |
2029 | 2040 | | |
| |||
2040 | 2051 | | |
2041 | 2052 | | |
2042 | 2053 | | |
2043 | | - | |
2044 | 2054 | | |
2045 | 2055 | | |
2046 | 2056 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
513 | 513 | | |
514 | 514 | | |
515 | 515 | | |
516 | | - | |
517 | | - | |
518 | | - | |
519 | | - | |
520 | | - | |
521 | | - | |
522 | 516 | | |
523 | 517 | | |
524 | 518 | | |
525 | 519 | | |
| 520 | + | |
526 | 521 | | |
527 | 522 | | |
528 | 523 | | |
529 | 524 | | |
530 | | - | |
531 | 525 | | |
532 | 526 | | |
533 | 527 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6363 | 6363 | | |
6364 | 6364 | | |
6365 | 6365 | | |
6366 | | - | |
6367 | | - | |
6368 | | - | |
6369 | | - | |
6370 | | - | |
6371 | | - | |
6372 | 6366 | | |
6373 | 6367 | | |
6374 | 6368 | | |
| |||
6908 | 6902 | | |
6909 | 6903 | | |
6910 | 6904 | | |
| 6905 | + | |
6911 | 6906 | | |
6912 | 6907 | | |
6913 | 6908 | | |
6914 | 6909 | | |
6915 | | - | |
6916 | 6910 | | |
6917 | 6911 | | |
6918 | 6912 | | |
| |||
6945 | 6939 | | |
6946 | 6940 | | |
6947 | 6941 | | |
6948 | | - | |
6949 | | - | |
6950 | | - | |
6951 | | - | |
6952 | | - | |
6953 | | - | |
6954 | | - | |
6955 | | - | |
6956 | | - | |
6957 | | - | |
6958 | | - | |
6959 | | - | |
6960 | | - | |
6961 | | - | |
6962 | 6942 | | |
6963 | 6943 | | |
6964 | | - | |
6965 | | - | |
6966 | | - | |
6967 | | - | |
6968 | | - | |
6969 | | - | |
6970 | | - | |
| 6944 | + | |
6971 | 6945 | | |
6972 | 6946 | | |
6973 | 6947 | | |
6974 | 6948 | | |
6975 | 6949 | | |
6976 | 6950 | | |
6977 | 6951 | | |
| 6952 | + | |
6978 | 6953 | | |
6979 | 6954 | | |
6980 | 6955 | | |
6981 | 6956 | | |
6982 | 6957 | | |
6983 | | - | |
6984 | | - | |
6985 | | - | |
6986 | | - | |
6987 | | - | |
6988 | | - | |
6989 | | - | |
6990 | | - | |
6991 | | - | |
6992 | | - | |
6993 | | - | |
6994 | | - | |
6995 | | - | |
6996 | | - | |
6997 | | - | |
6998 | | - | |
6999 | | - | |
7000 | | - | |
7001 | | - | |
7002 | | - | |
7003 | | - | |
7004 | | - | |
7005 | | - | |
7006 | | - | |
7007 | | - | |
7008 | 6958 | | |
7009 | 6959 | | |
7010 | 6960 | | |
| |||
7023 | 6973 | | |
7024 | 6974 | | |
7025 | 6975 | | |
| 6976 | + | |
7026 | 6977 | | |
7027 | 6978 | | |
7028 | 6979 | | |
7029 | 6980 | | |
7030 | | - | |
7031 | 6981 | | |
7032 | 6982 | | |
7033 | 6983 | | |
7034 | 6984 | | |
7035 | 6985 | | |
7036 | 6986 | | |
| 6987 | + | |
7037 | 6988 | | |
7038 | 6989 | | |
7039 | 6990 | | |
7040 | 6991 | | |
7041 | | - | |
7042 | 6992 | | |
7043 | 6993 | | |
7044 | 6994 | | |
| |||
0 commit comments