From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CB7D4C35280 for ; Fri, 8 May 2020 03:32:58 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9B59C2085B for ; Fri, 8 May 2020 03:32:58 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Ppj1/7ST"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="PBNLV2iZ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9B59C2085B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=BcQXN2Q6ttx+19eHfT9c+OsoDfO2TMV8rtH4pBvprzo=; b=Ppj1/7STXL2/DQ yq7aQHhDGYZo0oRGjZGIs6G3ZNluhIoAg58RLzRe6cdtnkjKqG+HLRiHvVvDNzojsvhHbE8E9cKFV pijJzcEDXfaQ8NIOHCs1fLKog/QAczDbnWB97lwAV9UlUSiLAtJBkGcAixCQmRN7kHsyLnOt5BYkJ tvnZbtwRpWKK9vunJmnI99aSJx/MW/LjkfBpVDlR6E6TbtuivopSzdGf3Dajk+Fo5QiTrC22W/xRH BGDZoC33XkzbcfFzTCBTrFXqdv3O9zH5G2YVucw6y6rEDQQC31suNcEnCTD6RanaWxmZ3DOAaB3rA LqYhqNA+xnCMda1a6Zzg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jWtku-0003qc-6A; Fri, 08 May 2020 03:32:56 +0000 Received: from us-smtp-2.mimecast.com ([207.211.31.81] helo=us-smtp-delivery-1.mimecast.com) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jWtjI-0002KF-JT for linux-arm-kernel@lists.infradead.org; Fri, 08 May 2020 03:31:19 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588908674; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=E8MHh9dyvpe8bslvZNsUP5j2B3v4NSqfl6A+NT0wxD4=; b=PBNLV2iZmfz3CoCQMxxp8HKLsT6+Uie1GKKGg2VXsH8XOkkkpt9OI2lv8kYtsdCWZu51Hu c9BeP5u3XHCPOhlPRlem8JMoyzgK35JJmFvjABqF8+xqXrvx0za+eCRbqLMRKGjVanYJYZ U3y46Gybq7utj4h4lHAEtuufm+fPGZM= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-259-kwm_sW8LPE6l4dM0Y68Z0w-1; Thu, 07 May 2020 23:31:13 -0400 X-MC-Unique: kwm_sW8LPE6l4dM0Y68Z0w-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6762D107ACCA; Fri, 8 May 2020 03:31:11 +0000 (UTC) Received: from localhost.localdomain.com (vpn2-54-199.bne.redhat.com [10.64.54.199]) by smtp.corp.redhat.com (Postfix) with ESMTP id 783242E052; Fri, 8 May 2020 03:31:03 +0000 (UTC) From: Gavin Shan To: kvmarm@lists.cs.columbia.edu Subject: [PATCH RFCv2 8/9] kernel/sched: Add cpu_rq_is_locked() Date: Fri, 8 May 2020 13:29:18 +1000 Message-Id: <20200508032919.52147-9-gshan@redhat.com> In-Reply-To: <20200508032919.52147-1-gshan@redhat.com> References: <20200508032919.52147-1-gshan@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200507_203116_744675_55C85C18 X-CRM114-Status: GOOD ( 11.32 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mark.rutland@arm.com, aarcange@redhat.com, drjones@redhat.com, suzuki.poulose@arm.com, maz@kernel.org, linux-kernel@vger.kernel.org, eric.auger@redhat.com, james.morse@arm.com, shan.gavin@gmail.com, catalin.marinas@arm.com, will@kernel.org, linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org This adds API cpu_rq_is_locked() to check if the CPU's runqueue has been locked or not. It's used in the subsequent patch to determine the task wakeup should be executed immediately or delayed. Signed-off-by: Gavin Shan --- include/linux/sched.h | 1 + kernel/sched/core.c | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/include/linux/sched.h b/include/linux/sched.h index 4418f5cb8324..e68882443da7 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -1691,6 +1691,7 @@ extern struct task_struct *find_task_by_pid_ns(pid_t nr, struct pid_namespace *n */ extern struct task_struct *find_get_task_by_vpid(pid_t nr); +extern bool cpu_rq_is_locked(int cpu); extern int wake_up_state(struct task_struct *tsk, unsigned int state); extern int wake_up_process(struct task_struct *tsk); extern void wake_up_new_task(struct task_struct *tsk); diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 9a2fbf98fd6f..30f4a8845495 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -73,6 +73,14 @@ __read_mostly int scheduler_running; */ int sysctl_sched_rt_runtime = 950000; +bool cpu_rq_is_locked(int cpu) +{ + struct rq *rq = cpu_rq(cpu); + + return raw_spin_is_locked(&rq->lock) ? true : false; +} +EXPORT_SYMBOL_GPL(cpu_rq_is_locked); + /* * __task_rq_lock - lock the rq @p resides on. */ -- 2.23.0 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel