Re: [RFC/PATCH] perf lock contention: Add -J/--inject-delay option
From: Namhyung Kim
Date: Fri May 09 2025 - 11:48:38 EST
On Thu, May 08, 2025 at 04:55:54PM -0300, Arnaldo Carvalho de Melo wrote:
> On Thu, May 08, 2025 at 10:30:02AM -0700, Namhyung Kim wrote:
> > On Thu, May 08, 2025 at 11:45:58AM -0300, Arnaldo Carvalho de Melo wrote:
> > > On Mon, Feb 24, 2025 at 11:59:29PM -0800, Namhyung Kim wrote:
> > > > This is to slow down lock acquistion (on contention locks) deliberately.
> > > > A possible use case is to estimate impact on application performance by
> > > > optimization of kernel locking behavior. By delaying the lock it can
> > > > simulate the worse condition as a control group, and then compare with
> > > > the current behavior as a optimized condition.
>
> > > So this looks useful, I guess we can proceed and merge it?
>
> > That'd be great. :)
>
> Can you please refresh it?
Sure, will send v2.
Thanks,
Namhyung
>
> ⬢ [acme@toolbox perf-tools-next]$ git am ./20250224_namhyung_perf_lock_contention_add_j_inject_delay_option.mbx
> Applying: perf lock contention: Add -J/--inject-delay option
> error: patch failed: tools/perf/util/bpf_skel/lock_contention.bpf.c:11
> error: tools/perf/util/bpf_skel/lock_contention.bpf.c: patch does not apply
> error: patch failed: tools/perf/util/lock-contention.h:140
> error: tools/perf/util/lock-contention.h: patch does not apply
> Patch failed at 0001 perf lock contention: Add -J/--inject-delay option
> hint: Use 'git am --show-current-patch=diff' to see the failed patch
> hint: When you have resolved this problem, run "git am --continue".
> hint: If you prefer to skip this patch, run "git am --skip" instead.
> hint: To restore the original branch and stop patching, run "git am --abort".
> hint: Disable this message with "git config set advice.mergeConflict false"
> ⬢ [acme@toolbox perf-tools-next]$ git am --abort
> ⬢ [acme@toolbox perf-tools-next]$
> ⬢ [acme@toolbox perf-tools-next]$ patch -p1 < ./20250224_namhyung_perf_lock_contention_add_j_inject_delay_option.mbx
> patching file tools/perf/Documentation/perf-lock.txt
> Hunk #1 succeeded at 216 (offset 1 line).
> patching file tools/perf/builtin-lock.c
> Hunk #2 succeeded at 2003 (offset 30 lines).
> Hunk #3 succeeded at 2508 (offset 30 lines).
> Hunk #4 succeeded at 2652 (offset 30 lines).
> patching file tools/perf/util/bpf_lock_contention.c
> Hunk #1 succeeded at 261 (offset 78 lines).
> Hunk #2 succeeded at 373 (offset 80 lines).
> patching file tools/perf/util/bpf_skel/lock_contention.bpf.c
> Hunk #1 succeeded at 14 with fuzz 2 (offset 3 lines).
> Hunk #2 succeeded at 152 (offset 35 lines).
> Hunk #3 FAILED at 153.
> Hunk #4 succeeded at 397 (offset 39 lines).
> Hunk #5 succeeded at 835 with fuzz 1 (offset 230 lines).
> 1 out of 5 hunks FAILED -- saving rejects to file tools/perf/util/bpf_skel/lock_contention.bpf.c.rej
> patching file tools/perf/util/lock-contention.h
> Hunk #2 succeeded at 146 with fuzz 1.
> Hunk #3 succeeded at 156 (offset 1 line).
> ⬢ [acme@toolbox perf-tools-next]$