Re: [RFC][PATCH] locking/rwsem: Add __sched annotation to __down_read_common()

From: John Stultz
Date: Tue Apr 11 2023 - 23:03:38 EST


On Tue, Apr 11, 2023 at 7:58 PM Waiman Long <longman@xxxxxxxxxx> wrote:
>
> On 4/11/23 22:38, John Stultz wrote:
> > Apparently despite it being marked inline, the compiler
> > may not inline __down_read_common() which makes it difficult
> > to identify the cause of lock contention, as the blocked
> > function will always be listed as __down_read_common().
> >
> > So this patch adds __sched annotation to the function so
> > the calling function will instead be listed.
> >
...
> > -static inline int __down_read_common(struct rw_semaphore *sem, int state)
> > +static inline __sched int __down_read_common(struct rw_semaphore *sem, int state)
> > {
> > int ret = 0;
> > long count;
>
> Change inline to __always_inline instead of adding __sched.
> __down_read_common() is not supposed to be a standalone function.

Sounds good. I'll give that a go and will re-submit!
Thanks for the review!
-john