From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S938874AbcISIYI (ORCPT ); Mon, 19 Sep 2016 04:24:08 -0400 Received: from bombadil.infradead.org ([198.137.202.9]:37400 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1760151AbcISIWB (ORCPT ); Mon, 19 Sep 2016 04:22:01 -0400 Date: Mon, 19 Sep 2016 10:21:58 +0200 From: Peter Zijlstra To: Joonwoo Park Cc: Srivatsa Vaddagiri , Ingo Molnar , linux-kernel@vger.kernel.org Subject: Re: [PATCH] sched: Fix SCHED_HRTICK bug leading to late preemption of tasks Message-ID: <20160919082158.GS5016@twins.programming.kicks-ass.net> References: <1474075731-11550-1-git-send-email-joonwoop@codeaurora.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1474075731-11550-1-git-send-email-joonwoop@codeaurora.org> User-Agent: Mutt/1.5.23.1 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Sep 16, 2016 at 06:28:51PM -0700, Joonwoo Park wrote: > From: Srivatsa Vaddagiri > > SCHED_HRTICK feature is useful to preempt SCHED_FAIR tasks on-the-dot Right, but I always found the overhead of the thing too high to be really useful. How come you're using this? > joonwoop: Do we also need to update or remove if-statement inside > hrtick_update()? > I guess not because hrtick_update() doesn't want to start hrtick when cfs_rq > has large number of nr_running where slice is longer than sched_latency. Right, you want that to match with whatever sched_slice() does. > +++ b/kernel/sched/fair.c > @@ -4458,7 +4458,7 @@ static void hrtick_start_fair(struct rq *rq, struct task_struct *p) > > WARN_ON(task_rq(p) != rq); > > - if (cfs_rq->nr_running > 1) { > + if (rq->cfs.h_nr_running > 1) { > u64 slice = sched_slice(cfs_rq, se); > u64 ran = se->sum_exec_runtime - se->prev_sum_exec_runtime; > s64 delta = slice - ran; Yeah, that looks right. I don't think I've ever tried hrtick with cgroups enabled...