From patchwork Tue May 12 14:46:43 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xunlei Pang X-Patchwork-Id: 48397 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f198.google.com (mail-wi0-f198.google.com [209.85.212.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 43BD4214A1 for ; Tue, 12 May 2015 14:49:03 +0000 (UTC) Received: by wixv7 with SMTP id v7sf3662645wix.0 for ; Tue, 12 May 2015 07:49:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=QOR95v5eGbgYWMqCvA3KWA1rQUsgKez5yUmZfpVhsmM=; b=BBjf2asB8w2n7h0hKwwA/cOMCl4RimenUO1lijbim9lLjfBd3Qs6LsKYMfYMTo0Ofo Ffcmzd4zySU4Jtuqf0bTmt1FggsAfp0G7Btuk44K6/tIDMg8NdcbGj7KH6wInG9+tCO+ UOAdEs+dBLtzUzItg3+Acg63rObq9KBrVgxMP4TRY+HvFZo4+JK+XqAQUZRqFoAdinCZ j3kRPr2Kk5+OnsZz4w+oBP9dBegmWg4a2wRElKs9/yjz7muZULqEN4lUDgJ4vDCIIfwS gjBBR97sfGki2KnKApn1q5OhSJ3MkMNLZhiVTVX8j5RFvFdJkbs00ov/TuM+1cPeEFTZ rRXA== X-Gm-Message-State: ALoCoQljHoqY/iv1JAmNioASqAsKA/kkx8UTDdLR6L30iLkQhUvClkuea4h3LBf5XdSoWp9/JYkt X-Received: by 10.152.87.140 with SMTP id ay12mr10882048lab.8.1431442142597; Tue, 12 May 2015 07:49:02 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.5.196 with SMTP id u4ls47659lau.6.gmail; Tue, 12 May 2015 07:49:02 -0700 (PDT) X-Received: by 10.152.246.34 with SMTP id xt2mr12377664lac.110.1431442142413; Tue, 12 May 2015 07:49:02 -0700 (PDT) Received: from mail-lb0-x22b.google.com (mail-lb0-x22b.google.com. [2a00:1450:4010:c04::22b]) by mx.google.com with ESMTPS id t2si10487019lbj.163.2015.05.12.07.49.02 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 May 2015 07:49:02 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2a00:1450:4010:c04::22b as permitted sender) client-ip=2a00:1450:4010:c04::22b; Received: by lbbuc2 with SMTP id uc2so7787075lbb.2 for ; Tue, 12 May 2015 07:49:02 -0700 (PDT) X-Received: by 10.112.198.74 with SMTP id ja10mr12437930lbc.19.1431442142301; Tue, 12 May 2015 07:49:02 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.108.230 with SMTP id hn6csp2136121lbb; Tue, 12 May 2015 07:49:01 -0700 (PDT) X-Received: by 10.68.186.1 with SMTP id fg1mr29015142pbc.147.1431442140142; Tue, 12 May 2015 07:49:00 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ji4si22797097pbd.56.2015.05.12.07.48.59; Tue, 12 May 2015 07:49:00 -0700 (PDT) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933430AbbELOsz (ORCPT + 28 others); Tue, 12 May 2015 10:48:55 -0400 Received: from m50-112.126.com ([123.125.50.112]:57826 "EHLO m50-112.126.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932983AbbELOsP (ORCPT ); Tue, 12 May 2015 10:48:15 -0400 Received: from localhost.localdomain (unknown [210.21.223.3]) by smtp6 (Coremail) with SMTP id j9KowAAnVHFdElJVTB0hBw--.1248S4; Tue, 12 May 2015 22:47:02 +0800 (CST) From: Xunlei Pang To: linux-kernel@vger.kernel.org Cc: Peter Zijlstra , Steven Rostedt , Juri Lelli , Ingo Molnar , Xunlei Pang Subject: [PATCH v3 3/4] sched/rt: Remove redundant conditions from task_woken_rt() Date: Tue, 12 May 2015 22:46:43 +0800 Message-Id: <1431442004-18716-3-git-send-email-xlpang@126.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1431442004-18716-1-git-send-email-xlpang@126.com> References: <1431442004-18716-1-git-send-email-xlpang@126.com> X-CM-TRANSID: j9KowAAnVHFdElJVTB0hBw--.1248S4 X-Coremail-Antispam: 1Uf129KBjvJXoW7AF1kKw1UJr4UGFyruF15urg_yoW8Kr18pa 1vkrWUWF1kJa45tanxtrn7Zry5Jw4kJw15XFn3trWUCrs8Jr1FvFWFgryS9r1Y9r10yF42 9FW8KayxG3WjgFJanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07jil1kUUUUU= X-Originating-IP: [210.21.223.3] X-CM-SenderInfo: p0ost0bj6rjloofrz/1tbipBH3v1Gogpt45gAAsD Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Original-Sender: xlpang@126.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2a00:1450:4010:c04::22b as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org; dkim=neutral (body hash did not verify) header.i=@; dmarc=fail (p=NONE dis=NONE) header.from=126.com Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Xunlei Pang - Remove "has_pushable_tasks(rq)". Because for queued p, "!task_running(rq, p)" and "p->nr_cpus_allowed > 1" already imply that "has_pushable_tasks(rq)" is true. - Remove "!test_tsk_need_resched(rq->curr)". The condtion mainly intends to ensure higher priority rt tasks won't be pushed away. I can think of two reasons below for getting rid of it. 1) With following "rq->curr->prio <= p->prio", we still can guarantee that purpose. "rq->curr->prio <= p->prio" implies the "need resched flag" wasn't set by check_preempt_curr() except the one set by check_preempt_equal_prio() for equal prio cases(In this case, if the condition is removed, it may result in an extra push_rt_tasks(), but this doesn't cause the wrong logic, in fact this extra push_rt_tasks() will probably return quickly for the case). Addtionally, there're also cases the "need resched flag" got set before the waking, with current implementation it needn't to push lower priority tasks as the cpu will schedule, while it will do an extra pushing if the condition is removed. But on the other hand, we can get a timely pushing for the woken tasks after the condition is removed(better for the non-preemptible kernel). 2) With following condtion "rq->curr->nr_cpus_allowed < 2" which was added by commit b3bc211cfe7d ("sched: Give CPU bound RT tasks preference"), in the scenario descibed in it, "need resched flag" was already set before by check_preempt_curr(), thus "!test_tsk_need_resched(rq->curr)" is always false which means with current implementation the commit is futile for task_woken_rt(). So, by removing this condition, we get the right logic. Signed-off-by: Xunlei Pang --- kernel/sched/rt.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c index 4a49c6a..4bd8551 100644 --- a/kernel/sched/rt.c +++ b/kernel/sched/rt.c @@ -2232,8 +2232,6 @@ out: static void task_woken_rt(struct rq *rq, struct task_struct *p) { if (!task_running(rq, p) && - !test_tsk_need_resched(rq->curr) && - has_pushable_tasks(rq) && p->nr_cpus_allowed > 1 && (dl_task(rq->curr) || rt_task(rq->curr)) && (rq->curr->nr_cpus_allowed < 2 ||