2024-04-17 10:33:19

by Tio Zhang

[permalink] [raw]
Subject: [PATCH 1/1] tracing/sched: sched_switch: place prev_comm and next_comm in right order

Switch the order of prev_comm and next_comm in sched_switch's code to
align with its printing order.

Signed-off-by: Tio Zhang <[email protected]>
---
include/trace/events/sched.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h
index dbb01b4b7451..a4bd4330db4c 100644
--- a/include/trace/events/sched.h
+++ b/include/trace/events/sched.h
@@ -239,11 +239,11 @@ TRACE_EVENT(sched_switch,
),

TP_fast_assign(
- memcpy(__entry->next_comm, next->comm, TASK_COMM_LEN);
+ memcpy(__entry->prev_comm, prev->comm, TASK_COMM_LEN);
__entry->prev_pid = prev->pid;
__entry->prev_prio = prev->prio;
__entry->prev_state = __trace_sched_switch_state(preempt, prev_state, prev);
- memcpy(__entry->prev_comm, prev->comm, TASK_COMM_LEN);
+ memcpy(__entry->next_comm, next->comm, TASK_COMM_LEN);
__entry->next_pid = next->pid;
__entry->next_prio = next->prio;
/* XXX SCHED_DEADLINE */
--
2.17.1



2024-04-23 10:32:31

by Madadi Vineeth Reddy

[permalink] [raw]
Subject: Re: [PATCH 1/1] tracing/sched: sched_switch: place prev_comm and next_comm in right order

Hi Tio zhang,

On 17/04/24 15:59, Tio Zhang wrote:
> Switch the order of prev_comm and next_comm in sched_switch's code to
> align with its printing order.
>
> Signed-off-by: Tio Zhang <[email protected]>
> ---
> include/trace/events/sched.h | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h
> index dbb01b4b7451..a4bd4330db4c 100644
> --- a/include/trace/events/sched.h
> +++ b/include/trace/events/sched.h
> @@ -239,11 +239,11 @@ TRACE_EVENT(sched_switch,
> ),
>
> TP_fast_assign(
> - memcpy(__entry->next_comm, next->comm, TASK_COMM_LEN);
> + memcpy(__entry->prev_comm, prev->comm, TASK_COMM_LEN);
> __entry->prev_pid = prev->pid;
> __entry->prev_prio = prev->prio;
> __entry->prev_state = __trace_sched_switch_state(preempt, prev_state, prev);
> - memcpy(__entry->prev_comm, prev->comm, TASK_COMM_LEN);
> + memcpy(__entry->next_comm, next->comm, TASK_COMM_LEN);
> __entry->next_pid = next->pid;
> __entry->next_prio = next->prio;
> /* XXX SCHED_DEADLINE */

Yes, makes sense to have all previous and then the next for increased readability.

Reviewed-by: Madadi Vineeth Reddy <[email protected]>