Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp11157801ybi; Thu, 25 Jul 2019 11:00:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqxhhqS6Jj5hKpyr3Y72FZuaotcn9P5+XQGGYEjcEmgwoF6uIMszRS8gAIA9S2Xx0wWcu/5Y X-Received: by 2002:a17:90a:3544:: with SMTP id q62mr94909306pjb.53.1564077642164; Thu, 25 Jul 2019 11:00:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564077642; cv=none; d=google.com; s=arc-20160816; b=KmqPeAYVsF25QiSJcSiRyyG4xbsupDDNFyfmX7cHwj6yH9GnP3Fgk3lY1eqTtT5aeJ KQ+wU8fUmQOH1KMIEMFzA6UZOMaTZRuQkQh7EE0MR2VMXgtBb0BANaZPaDy9A7D+11uY BmhzVkd2TbiErWJdxdLvhWmZt3KNw1ck4qihy/j4xGYDCpFqbusPvapYSyq1NR3Q1js6 J4PY2xlz4zJKBBJgc+7RVjIjBo6S+S2GnnrUNZ+u14/WRrF6RJ5kxtdqik7W7MxisyvU 0TEcLM2sKpPlqPEYtfO8eTCgyhOxqSfYLjrDm9Qs22FaPFYMzlOnl8ZS18yzcKcrj8mB 4X9A== 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; bh=Pju7MWYyhFzcCneYdSNeL8kIo+yxrjU1hVl11893rxA=; b=OBO3EOaNu1C0Mu7JBD+vplKfhV8Dcip6cbzwxKT9nqMZYQ5TfF/Yf8HXvks00sjEXn 3ryXum8B60s16HTB2nk8lOaLPX6nqW8+yczaWX64hiVSknZ/V8JcA+LCC5WRJSVeD1J3 TEtz8EEHy96d5biClf3hl5PpOZNr28RWLI/d6+m8eVmL/nZFziFgBHQc5k1jvsetSDRy IJQxT3K0wq87JTEt308z1t2j6Tv51gtzbyEYm2FIWs6dd3Q3w/qBtN7wOzIO7lJ5HUbn Rb8Ew85wnHSd7Nk6183Lz1trFqM0BSaxqLFWmZmckGroQcmQWoQS2pkPdL1K9J9JLygi goog== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a144si19101061pfd.72.2019.07.25.11.00.27; Thu, 25 Jul 2019 11:00:42 -0700 (PDT) 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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728866AbfGYOdw (ORCPT + 99 others); Thu, 25 Jul 2019 10:33:52 -0400 Received: from out30-54.freemail.mail.aliyun.com ([115.124.30.54]:36643 "EHLO out30-54.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725944AbfGYOdw (ORCPT ); Thu, 25 Jul 2019 10:33:52 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R111e4;CH=green;DM=||false|;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01f04446;MF=aaron.lu@linux.alibaba.com;NM=1;PH=DS;RN=20;SR=0;TI=SMTPD_---0TXn-kBY_1564065224; Received: from aaronlu(mailfrom:aaron.lu@linux.alibaba.com fp:SMTPD_---0TXn-kBY_1564065224) by smtp.aliyun-inc.com(127.0.0.1); Thu, 25 Jul 2019 22:33:46 +0800 Date: Thu, 25 Jul 2019 22:33:44 +0800 From: Aaron Lu To: Aubrey Li Cc: Julien Desfossez , Subhra Mazumdar , Vineeth Remanan Pillai , Nishanth Aravamudan , Peter Zijlstra , Tim Chen , Ingo Molnar , Thomas Gleixner , Paul Turner , Linus Torvalds , Linux List Kernel Mailing , =?iso-8859-1?Q?Fr=E9d=E9ric?= Weisbecker , Kees Cook , Greg Kerr , Phil Auld , Valentin Schneider , Mel Gorman , Pawan Gupta , Paolo Bonzini Subject: [PATCH 3/3] temp hack to make tick based schedule happen Message-ID: <20190725143344.GD992@aaronlu> References: <20190531210816.GA24027@sinkpad> <20190606152637.GA5703@sinkpad> <20190612163345.GB26997@sinkpad> <635c01b0-d8f3-561b-5396-10c75ed03712@oracle.com> <20190613032246.GA17752@sinkpad> <20190619183302.GA6775@sinkpad> <20190718100714.GA469@aaronlu> <20190725143003.GA992@aaronlu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190725143003.GA992@aaronlu> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When a hyperthread is forced idle and the other hyperthread has a single CPU intensive task running, the running task can occupy the hyperthread for a long time with no scheduling point and starve the other hyperthread. Fix this temporarily by always checking if the task has exceed its timeslice and if so, do a schedule. Signed-off-by: Aaron Lu --- kernel/sched/fair.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 43babc2a12a5..730c9359e9c9 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -4093,6 +4093,9 @@ check_preempt_tick(struct cfs_rq *cfs_rq, struct sched_entity *curr) return; } + if (cfs_rq->nr_running <= 1) + return; + /* * Ensure that a task that missed wakeup preemption by a * narrow margin doesn't have to wait for a full slice. @@ -4261,8 +4264,7 @@ entity_tick(struct cfs_rq *cfs_rq, struct sched_entity *curr, int queued) return; #endif - if (cfs_rq->nr_running > 1) - check_preempt_tick(cfs_rq, curr); + check_preempt_tick(cfs_rq, curr); } -- 2.19.1.3.ge56e4f7