Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7793527b authored by Lucas De Marchi's avatar Lucas De Marchi Committed by Ingo Molnar
Browse files

sched: Reset sched stats on fork()



The sched_stat fields are currently not reset upon fork.
Ingo's recent commit 6c594c21
did reset nr_migrations, but it didn't reset any of the
others.

This patch resets all sched_stat fields on fork.

Signed-off-by: default avatarLucas De Marchi <lucas.de.marchi@gmail.com>
Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <193b0f820907090457s7a3662f4gcdecdc22fcae857b@mail.gmail.com>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent a1ba4d8b
Loading
Loading
Loading
Loading
+31 −9
Original line number Diff line number Diff line
@@ -2573,14 +2573,36 @@ static void __sched_fork(struct task_struct *p)

#ifdef CONFIG_SCHEDSTATS
	p->se.wait_start			= 0;
	p->se.sum_sleep_runtime		= 0;
	p->se.wait_max				= 0;
	p->se.wait_count			= 0;
	p->se.wait_sum				= 0;

	p->se.sleep_start			= 0;
	p->se.block_start		= 0;
	p->se.sleep_max				= 0;
	p->se.sum_sleep_runtime			= 0;

	p->se.block_start			= 0;
	p->se.block_max				= 0;
	p->se.exec_max				= 0;
	p->se.slice_max				= 0;
	p->se.wait_max			= 0;

	p->se.nr_migrations_cold		= 0;
	p->se.nr_failed_migrations_affine	= 0;
	p->se.nr_failed_migrations_running	= 0;
	p->se.nr_failed_migrations_hot		= 0;
	p->se.nr_forced_migrations		= 0;
	p->se.nr_forced2_migrations		= 0;

	p->se.nr_wakeups			= 0;
	p->se.nr_wakeups_sync			= 0;
	p->se.nr_wakeups_migrate		= 0;
	p->se.nr_wakeups_local			= 0;
	p->se.nr_wakeups_remote			= 0;
	p->se.nr_wakeups_affine			= 0;
	p->se.nr_wakeups_affine_attempts	= 0;
	p->se.nr_wakeups_passive		= 0;
	p->se.nr_wakeups_idle			= 0;

#endif

	INIT_LIST_HEAD(&p->rt.run_list);