<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/include/trace/events/sched.h, branch linux-6.8.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-6.8.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-6.8.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2023-11-15T08:57:49Z</updated>
<entry>
<title>sched: Remove vruntime from trace_sched_stat_runtime()</title>
<updated>2023-11-15T08:57:49Z</updated>
<author>
<name>Peter Zijlstra</name>
</author>
<published>2023-11-06T12:41:43Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=5fe6ec8f6ab549b6422e41551abb51802bd48bc7'/>
<id>urn:sha1:5fe6ec8f6ab549b6422e41551abb51802bd48bc7</id>
<content type='text'>
Tracing the runtime delta makes sense, observer can sum over time.
Tracing the absolute vruntime makes less sense, inconsistent:
absolute-vs-delta, but also vruntime delta can be computed from
runtime delta.

Removing the vruntime thing also makes the two tracepoint sites
identical, allowing to unify the code in a later patch.

Signed-off-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
</content>
</entry>
<entry>
<title>sched/numa: Complete scanning of inactive VMAs when there is no alternative</title>
<updated>2023-10-10T21:42:15Z</updated>
<author>
<name>Mel Gorman</name>
</author>
<published>2023-10-10T08:31:43Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=f169c62ff7cd1acf8bac8ae17bfeafa307d9e6fa'/>
<id>urn:sha1:f169c62ff7cd1acf8bac8ae17bfeafa307d9e6fa</id>
<content type='text'>
VMAs are skipped if there is no recent fault activity but this represents
a chicken-and-egg problem as there may be no fault activity if the PTEs
are never updated to trap NUMA hints. There is an indirect reliance on
scanning to be forced early in the lifetime of a task but this may fail
to detect changes in phase behaviour. Force inactive VMAs to be scanned
when all other eligible VMAs have been updated within the same scan
sequence.

Test results in general look good with some changes in performance, both
negative and positive, depending on whether the additional scanning and
faulting was beneficial or not to the workload. The autonuma benchmark
workload NUMA01_THREADLOCAL was picked for closer examination. The workload
creates two processes with numerous threads and thread-local storage that
is zero-filled in a loop. It exercises the corner case where unrelated
threads may skip VMAs that are thread-local to another thread and still
has some VMAs that inactive while the workload executes.

The VMA skipping activity frequency with and without the patch:

	6.6.0-rc2-sched-numabtrace-v1
	=============================
	    649 reason=scan_delay
	  9,094 reason=unsuitable
	 48,915 reason=shared_ro
	143,919 reason=inaccessible
	193,050 reason=pid_inactive

	6.6.0-rc2-sched-numabselective-v1
	=============================
	    146 reason=seq_completed
	    622 reason=ignore_pid_inactive

	    624 reason=scan_delay
	  6,570 reason=unsuitable
	 16,101 reason=shared_ro
	 27,608 reason=inaccessible
	 41,939 reason=pid_inactive

Note that with the patch applied, the PID activity is ignored
(ignore_pid_inactive) to ensure a VMA with some activity is completely
scanned. In addition, a small number of VMAs are scanned when no other
eligible VMA is available during a single scan window (seq_completed).
The number of times a VMA is skipped due to no PID activity from the
scanning task (pid_inactive) drops dramatically. It is expected that
this will increase the number of PTEs updated for NUMA hinting faults
as well as hinting faults but these represent PTEs that would otherwise
have been missed. The tradeoff is scan+fault overhead versus improving
locality due to migration.

On a 2-socket Cascade Lake test machine, the time to complete the
workload is as follows;

                                                 6.6.0-rc2              6.6.0-rc2
                                       sched-numabtrace-v1 sched-numabselective-v1
  Min       elsp-NUMA01_THREADLOCAL      174.22 (   0.00%)      117.64 (  32.48%)
  Amean     elsp-NUMA01_THREADLOCAL      175.68 (   0.00%)      123.34 *  29.79%*
  Stddev    elsp-NUMA01_THREADLOCAL        1.20 (   0.00%)        4.06 (-238.20%)
  CoeffVar  elsp-NUMA01_THREADLOCAL        0.68 (   0.00%)        3.29 (-381.70%)
  Max       elsp-NUMA01_THREADLOCAL      177.18 (   0.00%)      128.03 (  27.74%)

The time to complete the workload is reduced by almost 30%:

                     6.6.0-rc2   6.6.0-rc2
                  sched-numabtrace-v1 sched-numabselective-v1 /
  Duration User       91201.80    63506.64
  Duration System      2015.53     1819.78
  Duration Elapsed     1234.77      868.37

In this specific case, system CPU time was not increased but it's not
universally true.

From vmstat, the NUMA scanning and fault activity is as follows;

                                        6.6.0-rc2      6.6.0-rc2
                              sched-numabtrace-v1 sched-numabselective-v1
  Ops NUMA base-page range updates       64272.00    26374386.00
  Ops NUMA PTE updates                   36624.00       55538.00
  Ops NUMA PMD updates                      54.00       51404.00
  Ops NUMA hint faults                   15504.00       75786.00
  Ops NUMA hint local faults %           14860.00       56763.00
  Ops NUMA hint local percent               95.85          74.90
  Ops NUMA pages migrated                 1629.00     6469222.00

Both the number of PTE updates and hint faults is dramatically
increased. While this is superficially unfortunate, it represents
ranges that were simply skipped without the patch. As a result
of the scanning and hinting faults, many more pages were also
migrated but as the time to completion is reduced, the overhead
is offset by the gain.

Signed-off-by: Mel Gorman &lt;mgorman@techsingularity.net&gt;
Signed-off-by: Ingo Molnar &lt;mingo@kernel.org&gt;
Tested-by: Raghavendra K T &lt;raghavendra.kt@amd.com&gt;
Link: https://lore.kernel.org/r/20231010083143.19593-7-mgorman@techsingularity.net
</content>
</entry>
<entry>
<title>sched/numa: Complete scanning of partial VMAs regardless of PID activity</title>
<updated>2023-10-10T21:41:47Z</updated>
<author>
<name>Mel Gorman</name>
</author>
<published>2023-10-10T08:31:42Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=b7a5b537c55c088d891ae554103d1b281abef781'/>
<id>urn:sha1:b7a5b537c55c088d891ae554103d1b281abef781</id>
<content type='text'>
NUMA Balancing skips VMAs when the current task has not trapped a NUMA
fault within the VMA. If the VMA is skipped then mm-&gt;numa_scan_offset
advances and a task that is trapping faults within the VMA may never
fully update PTEs within the VMA.

Force tasks to update PTEs for partially scanned PTEs. The VMA will
be tagged for NUMA hints by some task but this removes some of the
benefit of tracking PID activity within a VMA. A follow-on patch
will mitigate this problem.

The test cases and machines evaluated did not trigger the corner case so
the performance results are neutral with only small changes within the
noise from normal test-to-test variance. However, the next patch makes
the corner case easier to trigger.

Signed-off-by: Mel Gorman &lt;mgorman@techsingularity.net&gt;
Signed-off-by: Ingo Molnar &lt;mingo@kernel.org&gt;
Tested-by: Raghavendra K T &lt;raghavendra.kt@amd.com&gt;
Link: https://lore.kernel.org/r/20231010083143.19593-6-mgorman@techsingularity.net
</content>
</entry>
<entry>
<title>sched/numa: Trace decisions related to skipping VMAs</title>
<updated>2023-10-10T09:10:00Z</updated>
<author>
<name>Mel Gorman</name>
</author>
<published>2023-10-10T08:31:40Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=ed2da8b725b932b1e2b2f4835bb664d47ed03031'/>
<id>urn:sha1:ed2da8b725b932b1e2b2f4835bb664d47ed03031</id>
<content type='text'>
NUMA balancing skips or scans VMAs for a variety of reasons. In preparation
for completing scans of VMAs regardless of PID access, trace the reasons
why a VMA was skipped. In a later patch, the tracing will be used to track
if a VMA was forcibly scanned.

Signed-off-by: Mel Gorman &lt;mgorman@techsingularity.net&gt;
Signed-off-by: Ingo Molnar &lt;mingo@kernel.org&gt;
Link: https://lore.kernel.org/r/20231010083143.19593-4-mgorman@techsingularity.net
</content>
</entry>
<entry>
<title>sched/debug: Add new tracepoint to track compute energy computation</title>
<updated>2023-09-29T08:29:18Z</updated>
<author>
<name>Qais Yousef</name>
</author>
<published>2023-09-16T23:29:55Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=15874a3d27e6405e9d17595f83bd3ca1b6cab16d'/>
<id>urn:sha1:15874a3d27e6405e9d17595f83bd3ca1b6cab16d</id>
<content type='text'>
It was useful to track feec() placement decision and debug the spare
capacity and optimization issues vs uclamp_max.

Signed-off-by: Qais Yousef (Google) &lt;qyousef@layalina.io&gt;
Signed-off-by: Ingo Molnar &lt;mingo@kernel.org&gt;
Reviewed-by: Dietmar Eggemann &lt;dietmar.eggemann@arm.com&gt;
Acked-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
Link: https://lore.kernel.org/r/20230916232955.2099394-4-qyousef@layalina.io
</content>
</entry>
<entry>
<title>sched/tracing: Append prev_state to tp args instead</title>
<updated>2022-05-11T22:37:11Z</updated>
<author>
<name>Delyan Kratunov</name>
</author>
<published>2022-05-11T18:28:36Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=9c2136be0878c88c53dea26943ce40bb03ad8d8d'/>
<id>urn:sha1:9c2136be0878c88c53dea26943ce40bb03ad8d8d</id>
<content type='text'>
Commit fa2c3254d7cf (sched/tracing: Don't re-read p-&gt;state when emitting
sched_switch event, 2022-01-20) added a new prev_state argument to the
sched_switch tracepoint, before the prev task_struct pointer.

This reordering of arguments broke BPF programs that use the raw
tracepoint (e.g. tp_btf programs). The type of the second argument has
changed and existing programs that assume a task_struct* argument
(e.g. for bpf_task_storage access) will now fail to verify.

If we instead append the new argument to the end, all existing programs
would continue to work and can conditionally extract the prev_state
argument on supported kernel versions.

Fixes: fa2c3254d7cf (sched/tracing: Don't re-read p-&gt;state when emitting sched_switch event, 2022-01-20)
Signed-off-by: Delyan Kratunov &lt;delyank@fb.com&gt;
Signed-off-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
Acked-by: Steven Rostedt (Google) &lt;rostedt@goodmis.org&gt;
Link: https://lkml.kernel.org/r/c8a6930dfdd58a4a5755fc01732675472979732b.camel@fb.com
</content>
</entry>
<entry>
<title>sched/tracing: Don't re-read p-&gt;state when emitting sched_switch event</title>
<updated>2022-03-01T15:18:39Z</updated>
<author>
<name>Valentin Schneider</name>
</author>
<published>2022-01-20T16:25:19Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=fa2c3254d7cfff5f7a916ab928a562d1165f17bb'/>
<id>urn:sha1:fa2c3254d7cfff5f7a916ab928a562d1165f17bb</id>
<content type='text'>
As of commit

  c6e7bd7afaeb ("sched/core: Optimize ttwu() spinning on p-&gt;on_cpu")

the following sequence becomes possible:

		      p-&gt;__state = TASK_INTERRUPTIBLE;
		      __schedule()
			deactivate_task(p);
  ttwu()
    READ !p-&gt;on_rq
    p-&gt;__state=TASK_WAKING
			trace_sched_switch()
			  __trace_sched_switch_state()
			    task_state_index()
			      return 0;

TASK_WAKING isn't in TASK_REPORT, so the task appears as TASK_RUNNING in
the trace event.

Prevent this by pushing the value read from __schedule() down the trace
event.

Reported-by: Abhijeet Dharmapurikar &lt;adharmap@quicinc.com&gt;
Signed-off-by: Valentin Schneider &lt;valentin.schneider@arm.com&gt;
Signed-off-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
Reviewed-by: Steven Rostedt (Google) &lt;rostedt@goodmis.org&gt;
Link: https://lore.kernel.org/r/20220120162520.570782-2-valentin.schneider@arm.com
</content>
</entry>
<entry>
<title>sched/tracing: Remove the redundant 'success' in the sched tracepoint</title>
<updated>2021-06-10T15:16:20Z</updated>
<author>
<name>Ed Tsai</name>
</author>
<published>2021-04-22T12:22:26Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=58b9987de86cc5f154b5e91923676f952fcf8a93'/>
<id>urn:sha1:58b9987de86cc5f154b5e91923676f952fcf8a93</id>
<content type='text'>
'success' is left here for a long time and also it is meaningless
for the upper user. Just remove it.

[ There were some tools expecting this, and this may break them. But
  hopefully they've been fixed in the mean time. Otherwise this may be
  likely reverted - SDR ]

Link: https://lkml.kernel.org/r/20210422122226.9415-1-ed.tsai@mediatek.com

Cc: Peter Zijlstra &lt;peterz@infradead.org&gt;
Signed-off-by: Ed Tsai &lt;ed.tsai@mediatek.com&gt;
Signed-off-by: Steven Rostedt (VMware) &lt;rostedt@goodmis.org&gt;
</content>
</entry>
<entry>
<title>tracing: Fix various typos in comments</title>
<updated>2021-03-23T18:08:18Z</updated>
<author>
<name>Ingo Molnar</name>
</author>
<published>2021-03-23T17:49:35Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=f2cc020d7876de7583feb52ec939a32419cf9468'/>
<id>urn:sha1:f2cc020d7876de7583feb52ec939a32419cf9468</id>
<content type='text'>
Fix ~59 single-word typos in the tracing code comments, and fix
the grammar in a handful of places.

Link: https://lore.kernel.org/r/20210322224546.GA1981273@gmail.com
Link: https://lkml.kernel.org/r/20210323174935.GA4176821@gmail.com

Reviewed-by: Randy Dunlap &lt;rdunlap@infradead.org&gt;
Signed-off-by: Ingo Molnar &lt;mingo@kernel.org&gt;
Signed-off-by: Steven Rostedt (VMware) &lt;rostedt@goodmis.org&gt;
</content>
</entry>
<entry>
<title>kthread: remove comments about old _do_fork() helper</title>
<updated>2021-01-11T14:11:56Z</updated>
<author>
<name>Yanfei Xu</name>
</author>
<published>2021-01-11T10:48:07Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=cb5021ca622fe83923e0789f99fe7227cbcd3f68'/>
<id>urn:sha1:cb5021ca622fe83923e0789f99fe7227cbcd3f68</id>
<content type='text'>
The old _do_fork() helper has been removed in favor of kernel_clone().
Here correct some comments which still contain _do_fork()

Link: https://lore.kernel.org/r/20210111104807.18022-1-yanfei.xu@windriver.com
Cc: christian@brauner.io
Cc: linux-kernel@vger.kernel.org
Acked-by: Christian Brauner &lt;christian.brauner@ubuntu.com&gt;
Signed-off-by: Yanfei Xu &lt;yanfei.xu@windriver.com&gt;
Signed-off-by: Christian Brauner &lt;christian.brauner@ubuntu.com&gt;
</content>
</entry>
</feed>
