Linux RCU subsystem development
 help / color / mirror / Atom feed
From: Frederic Weisbecker <frederic@kernel.org>
To: Valentin Schneider <vschneid@redhat.com>
Cc: paulmck@kernel.org, rcu@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Peter Zijlstra <peterz@infradead.org>,
	Neeraj Upadhyay <quic_neeraju@quicinc.com>,
	Joel Fernandes <joel@joelfernandes.org>,
	Josh Triplett <josh@joshtriplett.org>,
	Boqun Feng <boqun.feng@gmail.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
	Lai Jiangshan <jiangshanlai@gmail.com>,
	Zqiang <qiang.zhang1211@gmail.com>
Subject: Re: [PATCH 2/2] context_tracking, rcu: Rename RCU_DYNTICKS_IDX to CT_DYNTICKS_IDX
Date: Mon, 15 Apr 2024 23:08:22 +0200	[thread overview]
Message-ID: <Zh2XRgIGDILD6u7Q@pavilion.home> (raw)
In-Reply-To: <xhsmhjzky8tww.mognet@vschneid-thinkpadt14sgen2i.remote.csb>

Le Mon, Apr 15, 2024 at 06:36:31PM +0200, Valentin Schneider a écrit :
> On 10/04/24 12:19, Paul E. McKenney wrote:
> > On Wed, Apr 10, 2024 at 12:30:55PM +0200, Frederic Weisbecker wrote:
> >> Le Tue, Apr 09, 2024 at 12:53:03PM -0700, Paul E. McKenney a écrit :
> >> > I am having a hard time getting too excited about the name.  I could
> >> > suggest CT_RCU_WATCHING_IDX, but that isn't exactly the shortest
> >> > possible name.
> >>
> >> I really like CT_RCU_WATCHING. It says everything. The _IDX isn't even
> >> needed after all. What do you think?
> >
> > Works for me!
> >
> 
> Sounds good to me too, thanks for the suggestion :)
> 
> Now, what about ct_dynticks() & friends? I was about to do:
> 
> -static __always_inline int ct_dynticks(void)
> +static __always_inline int ct_rcu_watching(void)
>  {
> -	return atomic_read(this_cpu_ptr(&context_tracking.state)) & CT_DYNTICKS_MASK;
> +	return atomic_read(this_cpu_ptr(&context_tracking.state)) & CT_RCU_WATCHING_MASK;
>  }

Yup!

> 
> ... but then realised that there's more siblings to the rcu_dynticks*()
> family;

Ouch right, sorry I forgot there is so much of this namespace. But in case you're
willing to clean that up:

> 
> AFAICT dynticks_nesting could also get the rcu_watching prefix treatment,
> `rcu_dynticks_task_exit() -> rcu_watching_task_exit` doesn't sound as

rcu_tasks_exit() ?

But Paul, is there a reason why check_holdout_task() doesn't check
ct_dynticks_cpu(task_cpu(t)) instead of maintaining this separate counter?

> obvious though. The rcu_dyntick event probably can't be renamed either.

I think we can rename trace_rcu_dyntick() to trace_rcu_watching()

> 
> I'm not sure how far to take the renaming; seeing things like:
> 
>   notrace bool rcu_is_watching(void)
>   {
>           bool ret;
> 
>           preempt_disable_notrace();
>           ret = !rcu_dynticks_curr_cpu_in_eqs();
>           preempt_enable_notrace();
>           return ret;
>   }
>   EXPORT_SYMBOL_GPL(rcu_is_watching);
> 
> makes me think most of the rcu_*dynticks / rcu_*eqs stuff could get an
> rcu_watching facelift?

The eqs part can stay as-is. But the *dynticks* needs an update.

> 
> Here are my current considerations for identifiers used in context_tracking
> in decreasing order of confidence:
> 
> | Old                                   | New                                                           |
> |---------------------------------------+---------------------------------------------------------------|
> | RCU_DYNTICKS_IDX                      | CT_RCU_WATCHING                                               |
> | RCU_DYNTICKS_MASK                     | CT_RCU_WATCHING_MASK                                          |
> | context_tracking.dynticks_nesting     | context_tracking.rcu_watching_nesting                         |

This can be context_tracking.nesting (and yes one day we might need to lock up
context_tracking.nesting and context_tracking.recursion together in a room and see
who wins after a day or two).

> | context_tracking.dynticks_nmi_nesting | context_tracking.rcu_watching_nmi_nesting [bit of a mouthful] |

context_tracking.nmi_nesting

> | rcu_dynticks_curr_cpu_in_eqs()        | rcu_watching_curr_cpu() [with an added negation]              |

Nice!

> |---------------------------------------+---------------------------------------------------------------|
> | TRACE_EVENT_RCU(rcu_dyntick,          | [Can't change?]                                               |

It can change. Officially trace events aren't ABI. Unoficially I wouldn't dare
changing the sched switch trace event but this one is fine.

> |---------------------------------------+---------------------------------------------------------------|
> | rcu_dynticks_task_enter()             | rcu_watching_task_enter()> | |

rcu_tasks_enter() ?

> | rcu_dynticks_task_exit()              | rcu_watching_task_exit()                                      |

rcu_tasks_exit() ?

> | rcu_dynticks_task_trace_enter()       | rcu_watching_task_trace_enter()                               |

rcu_tasks_trace_enter()?

> | rcu_dynticks_task_trace_exit()        | rcu_watching_task_trace_exit()                                |

rcu_tasks_trace_exit() ?

Thanks.

> 
> Thoughts?
> 

  reply	other threads:[~2024-04-15 21:08 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-27 11:29 [PATCH 0/2] context_tracking, rcu: Standardize naming related to contex_tracking.state Valentin Schneider
2024-03-27 11:29 ` [PATCH 1/2] treewide: context_tracking: Rename CONTEXT_FOO to CT_STATE_FOO Valentin Schneider
2024-04-04 13:30   ` Frederic Weisbecker
2024-03-27 11:29 ` [PATCH 2/2] context_tracking, rcu: Rename RCU_DYNTICKS_IDX to CT_DYNTICKS_IDX Valentin Schneider
2024-04-04 13:38   ` Frederic Weisbecker
2024-04-09 19:53     ` Paul E. McKenney
2024-04-10 10:30       ` Frederic Weisbecker
2024-04-10 19:19         ` Paul E. McKenney
2024-04-15 16:36           ` Valentin Schneider
2024-04-15 21:08             ` Frederic Weisbecker [this message]
2024-04-16  8:36               ` Valentin Schneider

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Zh2XRgIGDILD6u7Q@pavilion.home \
    --to=frederic@kernel.org \
    --cc=boqun.feng@gmail.com \
    --cc=jiangshanlai@gmail.com \
    --cc=joel@joelfernandes.org \
    --cc=josh@joshtriplett.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=paulmck@kernel.org \
    --cc=peterz@infradead.org \
    --cc=qiang.zhang1211@gmail.com \
    --cc=quic_neeraju@quicinc.com \
    --cc=rcu@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=vschneid@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox