Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp533749imw; Fri, 8 Jul 2022 07:18:03 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vOue2y17UFrIo+VWv0RrWZ7qepRt/87Hd0P52tP3D2mFp4IY6Me64JVSsUlIp+YSKe3sWm X-Received: by 2002:a63:6884:0:b0:415:b761:efa4 with SMTP id d126-20020a636884000000b00415b761efa4mr3091030pgc.274.1657289882899; Fri, 08 Jul 2022 07:18:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657289882; cv=none; d=google.com; s=arc-20160816; b=Q5Y39a9Jk/96+Gop4TA2sdd7cb1LGPVEZuuqViOAC+khxHNAyVgIOsyy4/mfLdybfZ sOf4xdOGt0MZHaxZ3XcVrjNnLznBg1zuszoGrT/WGzWu0vzA+uqe853ZRIowdLu5BtZ6 fHeb/ufyCyaRZsO26QXQTa/koIMMXKH9WEpznkx+OP1BArJhGjYZcKH4QMPFTZyRx7ja 2SFS5cPZtP/hlswQYpqPTXmAVrow+eRqT0KlNpxNo9UJpDn+7A+/FB1K2i7EpDd6UaXF AbIfaCD5T57pM/fHT8NtYHzzQtW/f3iR/dHkfEUd1QGVTK5E2k9TTixg2nQxLy8cioLd /mfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=KdpxrMXT2mCsDT4flLvoU9tUZBZs1h2+IEZln4wT0ls=; b=j1dTaHV44Tck7rp4VpqBK5218FRZpdAZbY5+dmRlESFA5Zb0/cIXUahb/3PCKeQbvm eT69kPhxJSk76byQk7Tz17DP97FC3NxrdduvgKc9J0EhukECmt15V142h/wpLtxkwVQL oezR+FT5Y3ZRKW7Gjo0dP8pzbwQkVpO4e+Icgn093hybIsjRaSukCJ5hqZaX1LF/JGZE xLcT6DcIwOESCtyXEr5TIDv6abBcSeeA0dYWwvHup52m38/E7KBgFPkiREjNCy1wCGD+ t3dAfKpD0VWXAdwsjGCr0jJ4jDl9mI3No0ItKVKy+roqZzai0c0OgNxAO+/p2ZRNtF6D oA7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=UXKO4evh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u12-20020a17090341cc00b0016be9fe161asi1852670ple.240.2022.07.08.07.17.50; Fri, 08 Jul 2022 07:18:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=UXKO4evh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238329AbiGHNyM (ORCPT + 99 others); Fri, 8 Jul 2022 09:54:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55474 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237997AbiGHNyL (ORCPT ); Fri, 8 Jul 2022 09:54:11 -0400 Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 328ADB12; Fri, 8 Jul 2022 06:54:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=KdpxrMXT2mCsDT4flLvoU9tUZBZs1h2+IEZln4wT0ls=; b=UXKO4evhThTvqEZFqMyNNOIb8H mhXcsLgaN+WdoU1oJEetE2SikVVvSroh0TQxpH9DWF3Bz8xwfVtrl0T2Cxgep8TAU1Ya0DMeBJw3q kuCprBGoFdkaPxztHNZbnGRyoSKCDrtk6BKYIv0Ywz2oVU7zowvLk4oooVgdf+KsLRdl42kynS6DI TKww+KiVwIhJVguForf8faxNWHRz6CeJ8eiA/DGI4+bKhOvePssn47Ve3bvDNn9JRAUPfIWIkWNeE LmmES4H3UfrvsnD5DqQ/hN5U7cfSe88NwPOLHnaTm6hOmSg4ctVjQOkTUNJnXJtOpX33ja6S74hbY FcqZTd+Q==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=worktop.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1o9oQJ-001kdl-7g; Fri, 08 Jul 2022 13:53:35 +0000 Received: by worktop.programming.kicks-ass.net (Postfix, from userid 1000) id 8546998007C; Fri, 8 Jul 2022 15:53:34 +0200 (CEST) Date: Fri, 8 Jul 2022 15:53:34 +0200 From: Peter Zijlstra To: John Keeping Cc: linux-kernel@vger.kernel.org, linux-rt-users@vger.kernel.org, Sebastian Andrzej Siewior , Thomas Gleixner , Steven Rostedt , Ingo Molnar , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , Valentin Schneider Subject: Re: [PATCH v2] sched/core: Always flush pending blk_plug Message-ID: References: <20220708093213.1635880-1-john@metanate.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220708093213.1635880-1-john@metanate.com> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.