From patchwork Wed Feb 4 01:12:21 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xunlei Pang X-Patchwork-Id: 44322 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-we0-f198.google.com (mail-we0-f198.google.com [74.125.82.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id EE6182034D for ; Wed, 4 Feb 2015 01:14:30 +0000 (UTC) Received: by mail-we0-f198.google.com with SMTP id q59sf23040292wes.1 for ; Tue, 03 Feb 2015 17:14:30 -0800 (PST) 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=Jgkw1i1ql6iAks4u4LeWS47zqtzEAkKZ3y2Wsq9mGn0=; b=LMShEfPfpxQIZFmjx7t+GIw/m0pvnV/+M7OA2U44n0pR1uqkGEHL+akgEHPIACgtGx R7moWBiT4gH9jIIyiWn0OzJgqB994LwYdQjoqlgJqdRZjT3GEJYaJ8TGqh0huLimSbSY ncyO61UjlfLf1wKQlav07StoMcYocRwan+5J5GnhfaViANQabPd+jlw5JEoNMH9uIBTe YHS9MRMe2YzDvbP/LYts8h7wIqZRs7j2cirzPhMryayU1ua+38mBfCT3n5MPDNemXl0+ DLRD4CsUHwiDvnBWTZlLl4ku2Bpoo3tv15150/BlAJaGMrR7A72TDnvmOLw0LJxTQ1wH fJPg== X-Gm-Message-State: ALoCoQlnhY5KVKLOi1aCkV6D26AFP5kWLISj7jMx28VXyRgX0M62ve6W9aD2XOJSaZTscJ9LT7vn X-Received: by 10.180.94.134 with SMTP id dc6mr2337609wib.2.1423012470232; Tue, 03 Feb 2015 17:14:30 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.206.37 with SMTP id ll5ls889089lac.53.gmail; Tue, 03 Feb 2015 17:14:30 -0800 (PST) X-Received: by 10.112.199.39 with SMTP id jh7mr28055077lbc.46.1423012470040; Tue, 03 Feb 2015 17:14:30 -0800 (PST) Received: from mail-lb0-x229.google.com (mail-lb0-x229.google.com. [2a00:1450:4010:c04::229]) by mx.google.com with ESMTPS id lv1si147463lac.49.2015.02.03.17.14.30 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 03 Feb 2015 17:14:30 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2a00:1450:4010:c04::229 as permitted sender) client-ip=2a00:1450:4010:c04::229; Received: by mail-lb0-f169.google.com with SMTP id f15so41784512lbj.0 for ; Tue, 03 Feb 2015 17:14:30 -0800 (PST) X-Received: by 10.152.116.43 with SMTP id jt11mr28122261lab.69.1423012469954; Tue, 03 Feb 2015 17:14:29 -0800 (PST) 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.35.133 with SMTP id h5csp186432lbj; Tue, 3 Feb 2015 17:14:29 -0800 (PST) X-Received: by 10.66.249.39 with SMTP id yr7mr42124049pac.43.1423012468179; Tue, 03 Feb 2015 17:14:28 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id hp4si178146pac.108.2015.02.03.17.14.27; Tue, 03 Feb 2015 17:14:28 -0800 (PST) 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 S934061AbbBDBOY (ORCPT + 29 others); Tue, 3 Feb 2015 20:14:24 -0500 Received: from m15-114.126.com ([220.181.15.114]:38657 "EHLO m15-114.126.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754605AbbBDBOV (ORCPT ); Tue, 3 Feb 2015 20:14:21 -0500 Received: from localhost.localdomain (unknown [210.21.223.3]) by smtp7 (Coremail) with SMTP id DsmowADn8VwectFU_IBWAA--.619S3; Wed, 04 Feb 2015 09:13:10 +0800 (CST) From: Xunlei Pang To: linux-kernel@vger.kernel.org Cc: Peter Zijlstra , Steven Rostedt , Juri Lelli , Xunlei Pang Subject: [PATCH RESEND 2/2] sched/rt: Add check_preempt_equal_prio() logic in pick_next_task_rt() Date: Wed, 4 Feb 2015 09:12:21 +0800 Message-Id: <1423012341-30265-2-git-send-email-xlpang@126.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1423012341-30265-1-git-send-email-xlpang@126.com> References: <1423012341-30265-1-git-send-email-xlpang@126.com> X-CM-TRANSID: DsmowADn8VwectFU_IBWAA--.619S3 X-Coremail-Antispam: 1Uf129KBjvJXoW7Aw1DWrWfAFW7tFyDtF1UKFg_yoW8ur1Upa 1Fk34fua1DA3W2q3WSyr4fAr45Gw1rA3yrJr97ta1jkw45Xa1jvr1ayF1ayrWjqr4kJa13 trsFy3y7Gr4Du3DanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07jTq2NUUUUU= X-Originating-IP: [210.21.223.3] X-CM-SenderInfo: p0ost0bj6rjloofrz/1tbiXAaWv1R0UwKpzwAAsk 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::229 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 check_preempt_curr() doesn't call sched_class::check_preempt_curr when the class of current is a higher level. So if there is a DL task running when doing this for RT, check_preempt_equal_prio() will definitely miss, which may result in some response latency for this RT task if it is pinned and there're some same-priority migratable rt tasks already queued. We should do the similar thing in select_task_rq_rt() when first picking rt tasks after running out of DL tasks. This patch tackles the issue by peeking the next rt task(RT1), and if find RT1 migratable, just requeue it to the tail of the rq using requeue_task_rt(rq, p, 0). In this way: - If there do have another rt task(RT2) with the same priority as RT1, RT2 will finally be picked as the running task. While RT1 will be pushed onto another cpu via RT1's post_schedule(), as RT1 is migratable. The difference from check_preempt_equal_prio() here is that we just don't care whether RT2 is migratable. - Otherwise, if there's no rt task with the same priority as RT1, RT1 will still be picked as the running task after the requeuing. Signed-off-by: Xunlei Pang --- kernel/sched/rt.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c index 4dacb6e..b2385ee 100644 --- a/kernel/sched/rt.c +++ b/kernel/sched/rt.c @@ -1477,6 +1477,21 @@ pick_next_task_rt(struct rq *rq, struct task_struct *prev) put_prev_task(rq, prev); +#ifdef CONFIG_SMP + /* + * If there's a running deadline task, check_preempt_curr() + * doesn't invoke check_preempt_curr_rt() for rt tasks, so + * we can do it here. + */ + if (prev->sched_class == &dl_sched_class && + rq->rt.rt_nr_total > 1) { + p = _pick_next_task_rt(rq, 1); /* peek only */ + if (p->nr_cpus_allowed != 1 && + cpupri_find(&rq->rd->cpupri, p, NULL)) + requeue_task_rt(rq, p, 0); + } +#endif + p = _pick_next_task_rt(rq, 0); /* The running task is never eligible for pushing */