Re: [PATCH v2 0/4] sched: Move task_mm_cid_work to mm delayed work

From: Gabriele Monaco
Date: Fri Dec 13 2024 - 06:32:03 EST


On Fri, 2024-12-13 at 10:54 +0100, Gabriele Monaco wrote:
> OVERHEAD COMPARISON
>
> [..]
>
> I will post another email with the scripts used to retrieve the data
> and
> more details about the runtime distribution.

This message contains the performance results produced by my scripts, which are attached.
The tracing is done via bpftrace while a simple bash script is spawning and killing the loads.

>From the histograms it's easier to see the distribution of the durations and if there are clear outliers.

TEST RESULTS ON HEAD

Running without loads on virtme-ng

@duration_max: 426
@duration_total: count 13, average 75, total 987

@durations:
[25, 30) 1 |@@@@@@@@@@@@@@@@@ |
[30, 35) 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ |
[35, 40) 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ |
[40, 45) 0 | |
[45, 50) 3 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@|
[50, 55) 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ |
[55, 60) 0 | |
[60, 65) 1 |@@@@@@@@@@@@@@@@@ |
[65, 70) 0 | |
[70, 75) 0 | |
[75, 80) 0 | |
[80, 85) 0 | |
[85, 90) 0 | |
[90, 95) 1 |@@@@@@@@@@@@@@@@@ |
[95, 100) 0 | |
[100, ...) 1 |@@@@@@@@@@@@@@@@@ |

@processes: 12
@threads: 12

Running with cpu loads on virtme-ng

@duration_max: 2508
@duration_total: count 35948, average 20, total 742603

@durations:
[10, 15) 1889 |@@@@@ |
[15, 20) 17278 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@|
[20, 25) 10742 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ |
[25, 30) 3327 |@@@@@@@@@@ |
[30, 35) 2350 |@@@@@@@ |
[35, 40) 326 | |
[40, 45) 5 | |
[45, 50) 1 | |
[50, 55) 2 | |
[55, 60) 1 | |
[60, 65) 2 | |
[65, 70) 2 | |
[70, 75) 0 | |
[75, 80) 0 | |
[80, 85) 1 | |
[85, 90) 0 | |
[90, 95) 1 | |
[95, 100) 1 | |
[100, ...) 20 | |

@processes: 129
@threads: 129

Running with fork loads on virtme-ng

@duration_max: 41
@duration_total: count 21, average 34, total 720

@durations:
[30, 35) 12 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@|
[35, 40) 8 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ |
[40, 45) 1 |@@@@ |

@processes: 3592
@threads: 3592

Running with thread loads on virtme-ng

@duration_max: 195
@duration_total: count 1286, average 31, total 41082

@durations:
(..., 10) 326 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ |
[10, 15) 10 |@ |
[15, 20) 0 | |
[20, 25) 1 | |
[25, 30) 61 |@@@@@@@@ |
[30, 35) 377 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@|
[35, 40) 264 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ |
[40, 45) 65 |@@@@@@@@ |
[45, 50) 32 |@@@@ |
[50, 55) 12 |@ |
[55, 60) 13 |@ |
[60, 65) 7 | |
[65, 70) 10 |@ |
[70, 75) 10 |@ |
[75, 80) 33 |@@@@ |
[80, 85) 26 |@@@ |
[85, 90) 13 |@ |
[90, 95) 6 | |
[95, 100) 2 | |
[100, ...) 18 |@@ |

@processes: 129
@threads: 4096

TEST RESULTS ON PATCH

Running without loads on virtme-ng

@duration_max: 42
@duration_total: count 20601, average 2, total 45496

@durations:
(..., 10) 20304 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@|
[10, 15) 1 | |
[15, 20) 4 | |
[20, 25) 29 | |
[25, 30) 33 | |
[30, 35) 11 | |
[35, 40) 156 | |
[40, 45) 63 | |

@processes: 12
@threads: 12

Running with cpu loads on virtme-ng

@duration_max: 774
@duration_total: count 38612, average 7, total 281558

@durations:
(..., 10) 34607 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@|
[10, 15) 2558 |@@@ |
[15, 20) 735 |@ |
[20, 25) 454 | |
[25, 30) 225 | |
[30, 35) 17 | |
[35, 40) 8 | |
[40, 45) 2 | |
[45, 50) 4 | |
[50, 55) 0 | |
[55, 60) 0 | |
[60, 65) 0 | |
[65, 70) 0 | |
[70, 75) 0 | |
[75, 80) 0 | |
[80, 85) 0 | |
[85, 90) 0 | |
[90, 95) 0 | |
[95, 100) 0 | |
[100, ...) 2 | |

@processes: 129
@threads: 129

Running with fork loads on virtme-ng

@duration_max: 457
@duration_total: count 45683, average 19, total 878511

@durations:
(..., 10) 8452 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ |
[10, 15) 7287 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ |
[15, 20) 12727 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@|
[20, 25) 2942 |@@@@@@@@@@@@ |
[25, 30) 2975 |@@@@@@@@@@@@ |
[30, 35) 7305 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ |
[35, 40) 2994 |@@@@@@@@@@@@ |
[40, 45) 676 |@@ |
[45, 50) 180 | |
[50, 55) 57 | |
[55, 60) 19 | |
[60, 65) 6 | |
[65, 70) 4 | |
[70, 75) 2 | |
[75, 80) 5 | |
[80, 85) 6 | |
[85, 90) 4 | |
[90, 95) 5 | |
[95, 100) 2 | |
[100, ...) 34 | |

@processes: 3982
@threads: 3982

Running with thread loads on virtme-ng

@duration_max: 1046
@duration_total: count 38643, average 21, total 833034

@durations:
(..., 10) 1631 |@@@@@ |
[10, 15) 11027 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ |
[15, 20) 14832 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@|
[20, 25) 1338 |@@@@ |
[25, 30) 1112 |@@@ |
[30, 35) 3781 |@@@@@@@@@@@@@ |
[35, 40) 1994 |@@@@@@ |
[40, 45) 464 |@ |
[45, 50) 262 | |
[50, 55) 200 | |
[55, 60) 294 |@ |
[60, 65) 620 |@@ |
[65, 70) 256 | |
[70, 75) 119 | |
[75, 80) 232 | |
[80, 85) 220 | |
[85, 90) 55 | |
[90, 95) 30 | |
[95, 100) 19 | |
[100, ...) 157 | |

@processes: 129
@threads: 4096


--
Gabriele Monaco
Senior Software Engineer - Kernel Real Time

Red Hat
gmonaco@xxxxxxxxxx   

#!/usr/bin/env bpftrace
/**
* Print durations and invocations
* Call this script with the duration in seconds as argument
* e.g. bpftrace func_benchmark.bt 30
*/

//tracepoint:sched:sched_wakeup
fentry:try_to_wake_up
{
if(args->p->mm != 0) {
@_mms[args->p->mm] = true;
@_processes[args->p->tgid] = true;
@_threads[args->p->pid] = true;
}
}

fentry:task_mm_cid_work
{
@start[tid] = nsecs;
@preemptions[tid] = (uint64)0;
}

fexit:task_mm_cid_work
/@start[tid]/
{
$curr_preemption = @preempted[tid] ? @preemptions[tid] : 0;
$duration = (nsecs - @start[tid] - $curr_preemption)/1000;
@durations = lhist($duration, 10, 100, 5);
@duration_total = stats($duration);
@duration_max = max($duration);
delete(@start[tid]);
delete(@preemptions[tid]);
delete(@preempted[tid]);
}

/* Support only one preemption, should be fine for non-sleeping functions */
tracepoint:sched:sched_switch
// /@start[args.prev_pid] || @start[args.next_pid]/
{
if (@start[args.prev_pid]) {
@preempted[args.prev_pid] = true;
@preemptions[args.prev_pid] = nsecs;
}
if (@start[args.next_pid] && @preempted[args.next_pid]) {
@preemptions[args.next_pid] = nsecs - @preemptions[args.next_pid];
}
}

//interval:s:30
interval:s:$1
{
exit();
}

END
{
@mms = len(@_mms);
@processes = len(@_processes);
@threads = len(@_threads);
clear(@_mms);
clear(@_processes);
clear(@_threads);
clear(@start);
clear(@preemptions);
clear(@preempted);
}

Attachment: runtest_mm_cid.sh
Description: application/shellscript