[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAM9d7ciHObwkvyy9Uz5NRb=KBY-HtXAtAJTgXocA6C42aBoAyg@mail.gmail.com>
Date: Mon, 14 Mar 2022 14:44:04 -0700
From: Namhyung Kim <namhyung@...nel.org>
To: Peter Zijlstra <peterz@...radead.org>
Cc: Ingo Molnar <mingo@...nel.org>, Will Deacon <will@...nel.org>,
Waiman Long <longman@...hat.com>,
Boqun Feng <boqun.feng@...il.com>,
LKML <linux-kernel@...r.kernel.org>,
Thomas Gleixner <tglx@...utronix.de>,
Steven Rostedt <rostedt@...dmis.org>,
Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
Byungchul Park <byungchul.park@....com>,
"Paul E. McKenney" <paulmck@...nel.org>,
Arnd Bergmann <arnd@...db.de>, linux-arch@...r.kernel.org,
bpf <bpf@...r.kernel.org>, Radoslaw Burny <rburny@...gle.com>
Subject: Re: [PATCH 2/4] locking: Apply contention tracepoints in the slow path
On Tue, Mar 1, 2022 at 1:04 AM Peter Zijlstra <peterz@...radead.org> wrote:
>
> On Mon, Feb 28, 2022 at 05:04:10PM -0800, Namhyung Kim wrote:
> > @@ -1718,9 +1726,11 @@ static __always_inline void __sched rtlock_slowlock(struct rt_mutex_base *lock)
> > {
> > unsigned long flags;
> >
> > + trace_contention_begin(lock, _RET_IP_, LCB_F_RT | TASK_RTLOCK_WAIT);
> > raw_spin_lock_irqsave(&lock->wait_lock, flags);
> > rtlock_slowlock_locked(lock);
> > raw_spin_unlock_irqrestore(&lock->wait_lock, flags);
> > + trace_contention_end(lock);
> > }
>
> Same, if you do it one level in, you can have the tracepoint itself look
> at current->__state.
So I tried this by reading the state in the trace like below:
+ TP_fast_assign(
+ __entry->lock_addr = lock;
+ __entry->flags = flags | get_current_state();
+ ),
But I sometimes see unrelated values which contain
__TASK_TRACED or __TASK_STOPPED and some unexpected values
like TASK_UNINTERRUPTIBLE for rwlocks. Maybe I missed something.
Anyway I think it's confusing and complicates things unnecessarily.
Probably it'd better using new flags like LCB_F_SPIN and LCB_F_WAIT.
Thanks,
Namhyung
Powered by blists - more mailing lists