public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: John Keeping <john@metanate.com>
Cc: linux-kernel@vger.kernel.org, linux-rt-users@vger.kernel.org,
	Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
	Thomas Gleixner <tglx@linutronix.de>,
	Steven Rostedt <rostedt@goodmis.org>,
	Ingo Molnar <mingo@redhat.com>,
	Juri Lelli <juri.lelli@redhat.com>,
	Vincent Guittot <vincent.guittot@linaro.org>,
	Dietmar Eggemann <dietmar.eggemann@arm.com>,
	Ben Segall <bsegall@google.com>, Mel Gorman <mgorman@suse.de>,
	Daniel Bristot de Oliveira <bristot@redhat.com>,
	Valentin Schneider <vschneid@redhat.com>
Subject: Re: [PATCH v2] sched/core: Always flush pending blk_plug
Date: Fri, 8 Jul 2022 15:53:34 +0200	[thread overview]
Message-ID: <Ysg23mJmFiBc/eA1@worktop.programming.kicks-ass.net> (raw)
In-Reply-To: <20220708093213.1635880-1-john@metanate.com>

On Fri, Jul 08, 2022 at 10:32:12AM +0100, John Keeping wrote:

> It seems that the intent here is to skip blk_flush_plug() in the case
> where a non-preemptible lock (such as a spinlock) has been converted to
> a rtmutex on RT, which is the case covered by the SM_RTLOCK_WAIT
> schedule flag.  But sched_submit_work() is only called from schedule()
> which is never called in this scenario, so the check can simply be
> deleted.

>  include/linux/sched/rt.h | 8 --------
>  kernel/sched/core.c      | 3 ---
>  2 files changed, 11 deletions(-)
> 
> diff --git a/include/linux/sched/rt.h b/include/linux/sched/rt.h
> index e5af028c08b49..994c25640e156 100644
> --- a/include/linux/sched/rt.h
> +++ b/include/linux/sched/rt.h
> @@ -39,20 +39,12 @@ static inline struct task_struct *rt_mutex_get_top_task(struct task_struct *p)
>  }
>  extern void rt_mutex_setprio(struct task_struct *p, struct task_struct *pi_task);
>  extern void rt_mutex_adjust_pi(struct task_struct *p);
> -static inline bool tsk_is_pi_blocked(struct task_struct *tsk)
> -{
> -	return tsk->pi_blocked_on != NULL;
> -}
>  #else
>  static inline struct task_struct *rt_mutex_get_top_task(struct task_struct *task)
>  {
>  	return NULL;
>  }
>  # define rt_mutex_adjust_pi(p)		do { } while (0)
> -static inline bool tsk_is_pi_blocked(struct task_struct *tsk)
> -{
> -	return false;
> -}
>  #endif
>  
>  extern void normalize_rt_tasks(void);

Excellent, glad to see the back of that.

> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index 1d4660a1915b3..e4974fe003b5b 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -6578,9 +6578,6 @@ static inline void sched_submit_work(struct task_struct *tsk)
>  			io_wq_worker_sleeping(tsk);
>  	}
>  
> -	if (tsk_is_pi_blocked(tsk))
> -		return;
> -

Would it make sense to replace this with:

	SCHED_WARN_ON(current->__state & TASK_RTLOCK_WAIT);

Along with a comment along the lines of:

>    - spinlock and rwlock must not flush block requests. This will deadlock
>      if the callback attempts to acquire a lock which is already acquired.
>      Similarly to being preempted, there should be no warning if the
>      scheduling point is within a RCU read section.

      reply	other threads:[~2022-07-08 13:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-08  9:32 [PATCH v2] sched/core: Always flush pending blk_plug John Keeping
2022-07-08 13:53 ` Peter Zijlstra [this message]

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=Ysg23mJmFiBc/eA1@worktop.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=bigeasy@linutronix.de \
    --cc=bristot@redhat.com \
    --cc=bsegall@google.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=john@metanate.com \
    --cc=juri.lelli@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rt-users@vger.kernel.org \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    --cc=vincent.guittot@linaro.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