Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp5171956ybl; Tue, 10 Dec 2019 01:34:32 -0800 (PST) X-Google-Smtp-Source: APXvYqwt+hR9zpjSIpQUDfezylDp5kIEpsWecok7W+Sk4EiPiSGBVI7dLxPGETdwjnoLsnr4aSQM X-Received: by 2002:a05:6830:1691:: with SMTP id k17mr19474039otr.282.1575970472928; Tue, 10 Dec 2019 01:34:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575970472; cv=none; d=google.com; s=arc-20160816; b=Adjj4GSBRxbGZ8ncKEjhH4hWqS50w5eukkRFvimM7AM+ehzcnsBrpeiArfKRgzVOrE GsEVX1ewRDClKGUpBB2cPhaQ+de8/ez1UwwID7/DQx0W9abrLNJVFciQ/bWtbuenhblq /3yyU2UROqj+sW5t39kvB9FLJ1M/JNYYou7xGoWEg4KOg1AtEMHiuR/Bzuw0AGNbEmKN McrHgK7gxBSJCBoqHcJ7RVhwJAXJgkNlKRuWeQrNTIbkAMGvpSxLL8se1B0AydLkVhM4 B38pppw8m9VnU7HcHbxpeNxrfYAMUWF1NopzahAMhyg9Wa/n3kPz/dueZuMTxxG7PQL4 VvKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=sMO1cch7CJcc30d1l4BAfw/KGbhW737PQA2xFFlz1to=; b=KSj6E13tgNycoTJeMEupw6XqnLWqxlbif9wtbO5LUWMdkm0JQcI1JOX8QWebP7QQcP JVH3I1zu4Agy9djrBc9vWbXK44WPkbwu9vefi3eIbEJUaCB9U9C/mEqjqGx7pNBJxF/o gg09sHGxJiu7SD3RZ7nyU43dKjr6oyUSmBulvitbTVWcv1FzPx6D0miwfRDSEHei3ik6 b0c0gKCxSARtFLVBJqluejd8iHi0bvQfEoXWL1iMrTn9skfpByyS48emUd8eHxDTYvzz j2xbmjrHPWbGhOoJ8FXFHanoiUIxjlUrPfmd+m0uTU6lGK+2N9Ansx8/NrtUNd0V0CSN bHGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=Naur3HOD; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u30si1832461otj.268.2019.12.10.01.34.19; Tue, 10 Dec 2019 01:34:32 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=Naur3HOD; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727131AbfLJJds (ORCPT + 99 others); Tue, 10 Dec 2019 04:33:48 -0500 Received: from bombadil.infradead.org ([198.137.202.133]:44404 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726915AbfLJJdr (ORCPT ); Tue, 10 Dec 2019 04:33:47 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; 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:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=sMO1cch7CJcc30d1l4BAfw/KGbhW737PQA2xFFlz1to=; b=Naur3HODwCXzNFmODUCUV8ISF /S1jRqpZu30XpYFoOz9DDcvllTj7H0nOUCV/njXaCdP0umq3wN+fJl+suPpcXyE9BAMXiKsoNZmJv qFr7emLfd+oApAiqTIn3PddjbDxQb+NT8RkhEqjjTbU51YIFu65fMQ+ss21qQ8zYlqqBfn3AWANaD wjz/1dcyVNSgS1jCROJkqWCBU2+E8THo4mlw+29AGlULG+p/wef1a9hLuMC+emNL8FC0OdsZP68PK iclDBT0bZ7I4b9NFh+8Kr8Rp8fj67T3umhCTbsoHU/B7TT2GrlOethQkmZRbR2MZDcisznN0ALOa7 wajhM4w5g==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1iebtk-0004v9-N4; Tue, 10 Dec 2019 09:33:40 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 24D77300596; Tue, 10 Dec 2019 10:32:19 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 7FDAB2010F142; Tue, 10 Dec 2019 10:33:38 +0100 (CET) Date: Tue, 10 Dec 2019 10:33:38 +0100 From: Peter Zijlstra To: Srikar Dronamraju Cc: Dave Chinner , Phil Auld , Ming Lei , linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-xfs@vger.kernel.org, linux-kernel@vger.kernel.org, Jeff Moyer , Dave Chinner , Eric Sandeen , Christoph Hellwig , Jens Axboe , Ingo Molnar , Tejun Heo , Vincent Guittot Subject: Re: [PATCH v2] sched/core: Preempt current task in favour of bound kthread Message-ID: <20191210093338.GF2871@hirez.programming.kicks-ass.net> References: <20191115234005.GO4614@dread.disaster.area> <20191118092121.GV4131@hirez.programming.kicks-ass.net> <20191118204054.GV4614@dread.disaster.area> <20191120191636.GI4097@hirez.programming.kicks-ass.net> <20191120220313.GC18056@pauld.bos.csb> <20191121132937.GW4114@hirez.programming.kicks-ass.net> <20191209165122.GA27229@linux.vnet.ibm.com> <20191209231743.GA19256@dread.disaster.area> <20191210054330.GF27253@linux.vnet.ibm.com> <20191210092601.GK2844@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191210092601.GK2844@hirez.programming.kicks-ass.net> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Dec 10, 2019 at 10:26:01AM +0100, Peter Zijlstra wrote: > > @@ -6716,7 +6737,7 @@ static void check_preempt_wakeup(struct rq *rq, struct task_struct *p, int wake_ > > find_matching_se(&se, &pse); > > update_curr(cfs_rq_of(se)); > > BUG_ON(!pse); > > - if (wakeup_preempt_entity(se, pse) == 1) { > > + if (wakeup_preempt_entity(se, pse) == 1 || kthread_wakeup_preempt(rq, p, wake_flags)) { > > /* > > * Bias pick_next to pick the sched entity that is > > * triggering this preemption. > > How about something like: > if (wakeup_preempt_entity(se, pse) >= !(wake_flags & WF_KTHREAD)) That's a slightly less convoluted expression for the same value :-)