Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp494221imm; Fri, 5 Oct 2018 07:11:10 -0700 (PDT) X-Google-Smtp-Source: ACcGV6194bZkhiEljql+Yhh9O3lkniXr8Y/ve0vVIdWLDQOxpMkVKIrXQX/Z5UkLCQJ4ynS2aJSn X-Received: by 2002:a62:adc:: with SMTP id 89-v6mr12184178pfk.56.1538748670752; Fri, 05 Oct 2018 07:11:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538748670; cv=none; d=google.com; s=arc-20160816; b=p9fCLNJaZdko3NygBCgWgU/Next2qqQjz94/9vsBAu3NRL/ZvLV9CY1s7pcyZiCVlk 28wEcKrSRyBt+s1V3Mmp3Z7l5nwKHlWhdD+b4efbuBgKUoVSNmb6VT/dxiQW9I0B2Ebo 0l0T1TtXsLrd/e/3Qt9L8uLt8S0x4yxkWskHRgQABiAmELuB6KDaIG7u350nWC84XEoE tLd+Oalk3EArW0S8c8lpmNK5EMqkNhcITMEtzEMP+2xmKWQ5SkOaEHQVTWTSULB8F+D3 Y6ygTCdEoP8QK9Mo+a9DynppJxWAey8m5vLD9rJqWXATXUhTbXlMS5KvipeIbkM8pDBW iVqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=+fLburQ7WTZt2BBgJMcLTGOfLhc8h33QTIyn9xBFeGU=; b=FihndEZtIJ/1orIbE93WH9GnzZ5HvPpkJ87GXqT5/nih9KPyjOihbeQcVLKn/gOp0d 3C38Y1Gyy2JHYlshcNC/tNTaBJFPcMd4FWV85YhehH0fGTasvzTJSWN7CxK4uC+SFAfj FPKM/jEDIIJBaMcBkU+vwL72Th87iqAa8dIfgsLC1QvExLUM1ZO76+ZHywwEwElqn/Ho afjbmwMnFtr8Oh5wPYrkzPmDiCKF07GLYjjMXbVBQRbrJYoA6wzMcjvVZt01ETCOTz+X Se/+LU9xr/LPn4+kYKRgmswTYwA1TVtI6t+GxmK9yn5ZFMymoW9GFwjuDjlSVgXwIpMz Ejjg== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h17-v6si8249984pgh.202.2018.10.05.07.10.54; Fri, 05 Oct 2018 07:11:10 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728407AbeJEVJm (ORCPT + 99 others); Fri, 5 Oct 2018 17:09:42 -0400 Received: from out1.zte.com.cn ([202.103.147.172]:39230 "EHLO mxct.zte.com.cn" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727581AbeJEVJm (ORCPT ); Fri, 5 Oct 2018 17:09:42 -0400 Received: from mse01.zte.com.cn (unknown [10.30.3.20]) by Forcepoint Email with ESMTPS id 1DA05B320BE619C67B1F; Fri, 5 Oct 2018 22:10:38 +0800 (CST) Received: from notes_smtp.zte.com.cn ([10.30.1.239]) by mse01.zte.com.cn with ESMTP id w95E9vNR033774; Fri, 5 Oct 2018 22:09:57 +0800 (GMT-8) (envelope-from peng.hao2@zte.com.cn) Received: from localhost.localdomain.localdomain ([10.74.120.59]) by szsmtp06.zte.com.cn (Lotus Domino Release 8.5.3FP6) with ESMTP id 2018100522103847-2724939 ; Fri, 5 Oct 2018 22:10:38 +0800 From: Peng Hao To: mingo@redhat.com, peterz@infradead.org Cc: rostedt@goodmis.org, linux-kernel@vger.kernel.org, Peng Hao Subject: [PATCH v3] sched/rt : return accurate release rq lock info Date: Sat, 6 Oct 2018 06:22:11 +0800 Message-Id: <1538778131-44406-1-git-send-email-peng.hao2@zte.com.cn> X-Mailer: git-send-email 1.8.3.1 X-MIMETrack: Itemize by SMTP Server on SZSMTP06/server/zte_ltd(Release 8.5.3FP6|November 21, 2013) at 2018-10-05 22:10:38, Serialize by Router on notes_smtp/zte_ltd(Release 9.0.1FP7|August 17, 2016) at 2018-10-05 22:09:41, Serialize complete at 2018-10-05 22:09:41 X-MAIL: mse01.zte.com.cn w95E9vNR033774 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org find_lock_lowest_rq may or not releease rq lock when return lowest_rq=NULL, but it is fuzzy. If not releasing rq lock, it is unnecessary to re-call pick_next_pushable_task. When CONFIG_PREEMPT=n, not releasing rq lock and return lowest_rq=null frequently happens in a simple test case: Four different rt priority tasks run on limited two cpus. Thanks for Steven Rostedt's advice. Signed-off-by: Peng Hao --- kernel/sched/rt.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c index 2e2955a..be0fc43 100644 --- a/kernel/sched/rt.c +++ b/kernel/sched/rt.c @@ -1754,7 +1754,7 @@ static struct rq *find_lock_lowest_rq(struct task_struct *task, struct rq *rq) !task_on_rq_queued(task))) { double_unlock_balance(rq, lowest_rq); - lowest_rq = NULL; + lowest_rq = RETRY_TASK; break; } } @@ -1830,7 +1830,9 @@ static int push_rt_task(struct rq *rq) /* find_lock_lowest_rq locks the rq if found */ lowest_rq = find_lock_lowest_rq(next_task, rq); - if (!lowest_rq) { + if (!lowest_rq) + goto out; + if (lowest_rq == RETRY_TASK) { struct task_struct *task; /* * find_lock_lowest_rq releases rq->lock -- 1.8.3.1