From patchwork Wed Jul 8 16:58:29 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xunlei Pang X-Patchwork-Id: 50902 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f197.google.com (mail-wi0-f197.google.com [209.85.212.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 014A722A03 for ; Wed, 8 Jul 2015 17:00:48 +0000 (UTC) Received: by wipp2 with SMTP id p2sf53449451wip.2 for ; Wed, 08 Jul 2015 10:00:47 -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=lXW7zPpfv+Leg4i9sFVpvlH0GFV4/NTZZsiKtH/VQ4U=; b=A4UFyo0OoDairi/hnoXHlkDlPzVe8KdYYKU0AQhr8TDeEkXtMAO7SKQnvxWabVDXoh Lzi0gI0W5k1NGKh6D2bJV1u3PRwmmIORLSiOpwVhMC9yu/OChnszUJ8clQ8FH/iXYIVZ OjMs/Hv6K6zilRifxy8T2tJPZulJyIKKiN+wfUR73S9bV0xfqsQ1habkC1eZ3HoULV5a VGvRLP4kMYFUilL/Pm+CTZIhamXKUISx2hrSklMWlafd/2OlwKAVbLypucGxdhrtQwG4 /KhtFDjGgh489FIX13iddKI74/Gk8IScW2ZvAzlJxEPMJLQmrXO2LIH8DMnNDrOpWjS8 wBiw== X-Gm-Message-State: ALoCoQnY4e37sZyQ0YmPaMbv+merTeVL2NIKWO1HXyGwKWH07f7vk143lcg1jwXvAii0XemcWBHj X-Received: by 10.181.13.202 with SMTP id fa10mr172634wid.4.1436374847049; Wed, 08 Jul 2015 10:00:47 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.25.134 with SMTP id c6ls982589lag.54.gmail; Wed, 08 Jul 2015 10:00:46 -0700 (PDT) X-Received: by 10.112.10.166 with SMTP id j6mr9608687lbb.120.1436374846844; Wed, 08 Jul 2015 10:00:46 -0700 (PDT) Received: from mail-la0-x22a.google.com (mail-la0-x22a.google.com. [2a00:1450:4010:c03::22a]) by mx.google.com with ESMTPS id yw1si2440303lbb.129.2015.07.08.10.00.46 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 08 Jul 2015 10:00:46 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2a00:1450:4010:c03::22a as permitted sender) client-ip=2a00:1450:4010:c03::22a; Received: by laar3 with SMTP id r3so230095953laa.0 for ; Wed, 08 Jul 2015 10:00:46 -0700 (PDT) X-Received: by 10.152.88.77 with SMTP id be13mr10368202lab.112.1436374846691; Wed, 08 Jul 2015 10:00:46 -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 hn6csp88673lbb; Wed, 8 Jul 2015 10:00:45 -0700 (PDT) X-Received: by 10.70.133.170 with SMTP id pd10mr22472984pdb.127.1436374844736; Wed, 08 Jul 2015 10:00:44 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ld8si4956443pbc.211.2015.07.08.10.00.41; Wed, 08 Jul 2015 10:00:44 -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; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935141AbbGHRAj (ORCPT + 29 others); Wed, 8 Jul 2015 13:00:39 -0400 Received: from m50-112.126.com ([123.125.50.112]:42671 "EHLO m50-112.126.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934190AbbGHRAh (ORCPT ); Wed, 8 Jul 2015 13:00:37 -0400 Received: from localhost.localdomain (unknown [210.21.223.3]) by smtp6 (Coremail) with SMTP id j9KowACHr4vlVp1Vvy+DAg--.16591S4; Thu, 09 Jul 2015 00:59:24 +0800 (CST) From: Xunlei Pang To: linux-kernel@vger.kernel.org Cc: Peter Zijlstra , Steven Rostedt , Juri Lelli , Ingo Molnar , Xunlei Pang Subject: [PATCH v5 2/2] sched/deadline: Check to push the task away after its affinity was changed Date: Thu, 9 Jul 2015 00:58:29 +0800 Message-Id: <1436374709-26703-2-git-send-email-xlpang@126.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1436374709-26703-1-git-send-email-xlpang@126.com> References: <1436374709-26703-1-git-send-email-xlpang@126.com> X-CM-TRANSID: j9KowACHr4vlVp1Vvy+DAg--.16591S4 X-Coremail-Antispam: 1Uf129KBjvJXoW7AF4fJw13Jry8Cr13WFWUCFg_yoW8uFyUpF Z2ka45Wa1DJay0q343Zrs5AFy5Wwn7J34ayF1ftrWkCFZ5XF4jvF90vF45XFZxKrn29a12 qF1vqryIkF1jy3DanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07jlc_3UUUUU= X-Originating-IP: [210.21.223.3] X-CM-SenderInfo: p0ost0bj6rjloofrz/1tbiXA0xv1R0XM3ThgAAs7 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:c03::22a as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org; dkim=neutral (body hash did not verify) header.i=@126.com; 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 (Sync up the same behaviour as that of RT) We may suffer from extra dl overload rq due to the affinity, so when the affinity of any runnable dl task is changed, we should check to trigger balancing, otherwise it will cause some unnecessary delayed real-time response. Unfortunately, current DL global scheduler does nothing about this. This patch modified set_cpus_allowed_dl(), if the target task is runnable but not running and not throttled, it tries to push it away once it got migratable. The patch also solves a problem about move_queued_task() called in set_cpus_allowed_ptr(): When a larger deadline value dl task got migrated due to its curr cpu isn't in the new affinity mask, after move_queued_task() it will miss the chance of pushing away, because check_preempt_curr() called by move_queued_task() doens't set the "need resched flag" for larger deadline value tasks. Signed-off-by: Xunlei Pang --- kernel/sched/deadline.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c index 20772ee..9f4691f 100644 --- a/kernel/sched/deadline.c +++ b/kernel/sched/deadline.c @@ -1706,11 +1706,12 @@ static void set_cpus_allowed_dl(struct task_struct *p, weight = cpumask_weight(new_mask); /* - * Only update if the process changes its state from whether it - * can migrate or not. + * Skip updating the migration stuff if the process doesn't change + * its migrate state, but still need to check if it can be pushed + * away due to its new affinity. */ if ((p->nr_cpus_allowed > 1) == (weight > 1)) - return; + goto queue_push; /* * The process used to be able to migrate OR it can now migrate @@ -1727,6 +1728,13 @@ static void set_cpus_allowed_dl(struct task_struct *p, } update_dl_migration(&rq->dl); + +queue_push: + if (weight > 1 && + !task_running(rq, p) && + !test_tsk_need_resched(rq->curr) && + !cpumask_subset(new_mask, &p->cpus_allowed)) + queue_push_tasks(rq); } /* Assumes rq->lock is held */