Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp801553ybl; Thu, 12 Dec 2019 05:13:52 -0800 (PST) X-Google-Smtp-Source: APXvYqzZ+GQt2nf0Fueq7tBHcrksJrcQ8E254FoSKUdtG6c/h1SrnN/KxVWAK3VjqUjEQqxb7Q1v X-Received: by 2002:a9d:6e89:: with SMTP id a9mr7621400otr.38.1576156432603; Thu, 12 Dec 2019 05:13:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576156432; cv=none; d=google.com; s=arc-20160816; b=Qav/8UQEe2ZLOWalskB3UoGxAPFPEsZqmV+HWUg+A6ZAjT2pgGqh0G0I9XqnZCrO7H +1JAOwPfdKzkb2hK+Ouo09aqPviclDJoftnVtFRdiYhEHSu0fb2xPfyqGKwJsVOgS+1T AyrQzqXYHGPvxI4EoBI8nyPxUbrSJnjZHa0B7sDBEayEK0gNwfzrC1j8VQAM03LmWfwM YoIPcs2mLDIEX6ICs8T7Je2ByW6yFbiOtx0mnuIeBjYUOEIuD9u1oZ/4dlXl7Wpxus5r Y9zLeCntJ8f+SeZVlhroCM8BHSUgVRe+CjDqAwd4VMwvm6gecRa56nVG9Fsgb1ugsZ9Y sORQ== 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=Mi/YeA+WCgrkkaP3IUCQ5eXMERR2u2J8/KyXlUMxhsE=; b=jUn4n+Ql7ZbfpndfoAaf1F5jk/zSjtB9lDalKtPEPnVJjJPvA12taL7Bo4cNkXAtMg +6BEalNvKRjm4D+xkRACBTfpytsXWH85zE5JJPngkGGIqHKVx9U/2DA65luigLh5oBkt cymHdIH1qgdq99H/mVe61QKBxFlz8ymFU5VOD34bkusw0SVo1V7DP4my8fG3CGLKOV25 Jb/tzvbkQby5GUKpJfipwE7tXaLYw6jLE5Fcx4p6gKoaWoBRW7EDUvG+2FBjqwJD5RPh v99KptjT2bfmi4CjJamllL1P3d/MpWwYVKsRtIK8p61XTz6yOohNYI9Q+erRmlaVIH0Y C1MQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=S2gx1qRE; 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 e5si3232336otr.247.2019.12.12.05.13.39; Thu, 12 Dec 2019 05:13:52 -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=merlin.20170209 header.b=S2gx1qRE; 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 S1729366AbfLLNNG (ORCPT + 99 others); Thu, 12 Dec 2019 08:13:06 -0500 Received: from merlin.infradead.org ([205.233.59.134]:39838 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728996AbfLLNNG (ORCPT ); Thu, 12 Dec 2019 08:13:06 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.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=Mi/YeA+WCgrkkaP3IUCQ5eXMERR2u2J8/KyXlUMxhsE=; b=S2gx1qRERPnBJWKB6odU0gfHJ Io+0i7BKBcpoqwishvDmCIx3U83XeZEDzTtyk6o/vY4WNhGGpgMr33r5Xkz8KxPkZmbYkbtLZJdf6 2H6hG7zJ8uGDO1IquD+xfTW59+narXHB94w5Wz2UVpIVt2sYSUk9jQl/b4nolTM+jgLeg0EKj3f6y DcPRlxcpeHAajXYpMtSHKKGRmWMf/vZIDRXY6u5NL14xRMK3JA0gTQvQeEAWDq1GlXYbTTJJUxmp7 cB3HVp7jTpLleY90VXPi2wTeWEZf5xARINmVaSAPeUXFONfryGgbC+Db61Pu2vV404tywa77Hws7M h9/plfWpQ==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1ifOGw-0000yE-7k; Thu, 12 Dec 2019 13:12:50 +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 C9107300F29; Thu, 12 Dec 2019 14:11:26 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 1D801203BF6F0; Thu, 12 Dec 2019 14:12:47 +0100 (CET) Date: Thu, 12 Dec 2019 14:12:47 +0100 From: Peter Zijlstra To: Vincent Guittot Cc: Dave Chinner , Srikar Dronamraju , Phil Auld , Ming Lei , linux-block , linux-fs , linux-xfs , linux-kernel , Jeff Moyer , Dave Chinner , Eric Sandeen , Christoph Hellwig , Jens Axboe , Ingo Molnar , Tejun Heo Subject: Re: [PATCH v4] sched/core: Preempt current task in favour of bound kthread Message-ID: <20191212131247.GY2827@hirez.programming.kicks-ass.net> References: <20191209165122.GA27229@linux.vnet.ibm.com> <20191209231743.GA19256@dread.disaster.area> <20191210054330.GF27253@linux.vnet.ibm.com> <20191210172307.GD9139@linux.vnet.ibm.com> <20191211173829.GB21797@linux.vnet.ibm.com> <20191211224617.GE19256@dread.disaster.area> <20191212101031.GV2827@hirez.programming.kicks-ass.net> <20191212101424.GH2871@hirez.programming.kicks-ass.net> <20191212102327.GI2871@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 Thu, Dec 12, 2019 at 12:20:01PM +0100, Vincent Guittot wrote: > On Thu, 12 Dec 2019 at 11:23, Peter Zijlstra wrote: > > Just for giggles, that'd look something like: > > > > while (!entity_is_task(se) { > > cfs_rq = group_cfs_rq(se); > > se = pick_next_entity(cfs_rq, cfs_rq->curr); > > } > > p = task_of(se); > > > > if (is_per_cpu_kthread(p)) > > ideal_runtime /= 2; > > > > the core-scheduling patch set includes the right primitive for this I > > think, pick_task_fair(). > > why not only updating wan_gran() which is the only function which uses > sysctl_sched_wakeup_granularity ? I don't see how, it works on se, which need not be a task. > For per cpu kthread, we could set the gran to sched_min_granularity > instead of scaling it with thread's priority so per cpu kthread can > still preempt current ask even if sysctl_sched_wakeup_granularity is > large Also, we're not poking at wakeup preemption anymore. That, as explained by Dave, is not the right thing to do. What we want instead is to make tick preemption a little more agressive. And tick based preemption currently purely looks at the leftmost entity for each runqueue we find while iterating current. IE, it might never even see the task we tagged with next. Also, did I say I hates cgroups :-)