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=-13.0 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable 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 D1146C433E5 for ; Tue, 21 Jul 2020 04:19:43 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 9B44720792 for ; Tue, 21 Jul 2020 04:19:43 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="ozaTe0aF"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="J9kQIHBi" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9B44720792 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+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=merlin.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=lmYZrdntv8YOohzH2Wf3ptwSPHlcNOtWKcqJgpQIa38=; b=ozaTe0aFVUGtoqAL59r1B6umR puG89i/zqniTkqMbs0MUgPu0HqTsljEbqcMrbi8R2g/hPJgbgkaZw8k+rBmJlj1gkTK12f2bXcPwN sVMgYbgIpn594hP3PwtUDxgdJlaZydRLueEVMEFJycfjEudkxT5ihcD9sTcZ8Gmr3zVxaWUboQSn+ ikjSrybea74TgacYEWzYUam7L85rqsMhpkpiZk+swoFJMDXhGK8v0soeUcX/ZvHEl5dlBTBWDDRG7 cJiNezK77imsqr09OTQaBltUG1wZZJeSaAXSkGvLk+zRYBxnJcIDc1kBDrjeheXP0zcWdNmEO79Mm Nogr1iB+A==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jxjjU-0005lg-20; Tue, 21 Jul 2020 04:18:24 +0000 Received: from mail-pl1-x641.google.com ([2607:f8b0:4864:20::641]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jxjjP-0005kA-PZ for linux-arm-kernel@lists.infradead.org; Tue, 21 Jul 2020 04:18:20 +0000 Received: by mail-pl1-x641.google.com with SMTP id d1so9693361plr.8 for ; Mon, 20 Jul 2020 21:18:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=HdrgiDjwQi3OXxJsXUESa6n0z/319Mf+JqDHrOU66kg=; b=J9kQIHBiFR2cBCKxhL+j9PrgKpcG/r5Le8QseNCHRtjcterReYFiv7fvrhsU4CcS00 C357fOgCmIvXpjMyqWX9aLfF2IYPjDTz8jRD7icKJCrsELYfzDqy43kknkJLNIDeIEVW WQCG4iOa5n/ZacA/O3S1XnrsihQqfsz9hzsfKmTpv8WWHlIZ3MqgeKtOUECEe2W2TyUN hR+l3HUDsNFWs/M9YBUrI1wOGIpfZNoN/q4qAat105HU7y8ZQtOPfbQh3BzkiZL+FMT7 1GUBAZ0smgg07lgbKHTGCvrEqFBXkEDa//CkdpMhiPkD+VvyDEpu2lk+MxRfXdlCeAGl 2qKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=HdrgiDjwQi3OXxJsXUESa6n0z/319Mf+JqDHrOU66kg=; b=drt0vfRLZP690VnsoQ+qQFXL26CleSh5FOkagKUgZw18Wtxepshad3J0/qv2/hAQfY Ln8nRpAbSpmB+ouHZi4ORqP7OdA+L0xU/ZtHMhR2WixcFXLZ2eEecfTuYYZW43af305Q AStAgA0ZoNoZVD9x+dmomLx0ACF7HtuQX+g+AP4hQphymiLoOMHrLkmdKdwKRvWRItd3 2G1nQxnR4+sZSWwBkuKRsUaTwt6wgiUxi47I8HCEewW7lh3O5oy52A3dWXp7/i/gd1BK IMBsGGeWDs2l/fLMu7hDTvXw+uqbYcsHjN0iO0rNXQvdGWcJsJdl7/fAeduTB/hu4idR fncg== X-Gm-Message-State: AOAM53002YluEjy20xbK3F75+Y7EKC6pShAH/bzyRcR4hspgPhfYi4Mf eXIqROsNyZDcD+S6ejtQreM= X-Google-Smtp-Source: ABdhPJyue+HTI0GPUR9dn0lDQER+qd43Q72CqYIHp9HX2nZ8SZRkDJx0a1ktEgktFA2ACThVp6s6CA== X-Received: by 2002:a17:902:ed02:: with SMTP id b2mr21034822pld.121.1595305097820; Mon, 20 Jul 2020 21:18:17 -0700 (PDT) Received: from localhost.localdomain ([2409:10:2e40:5100:6e29:95ff:fe2d:8f34]) by smtp.gmail.com with ESMTPSA id e28sm18467270pfm.177.2020.07.20.21.18.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Jul 2020 21:18:17 -0700 (PDT) From: Sergey Senozhatsky To: Will Deacon , Marc Zyngier , James Morse , Julien Thierry , Suzuki K Poulose Subject: [RFC][PATCH 4/4] arm64: do not use dummy vcpu_is_preempted() anymore Date: Tue, 21 Jul 2020 13:17:42 +0900 Message-Id: <20200721041742.197354-5-sergey.senozhatsky@gmail.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200721041742.197354-1-sergey.senozhatsky@gmail.com> References: <20200721041742.197354-1-sergey.senozhatsky@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200721_001819_911762_8E6E51DE X-CRM114-Status: GOOD ( 10.40 ) 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: joelaf@google.com, linux-kernel@vger.kernel.org, Sergey Senozhatsky , suleiman@google.com, kvmarm@lists.cs.columbia.edu, 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+linux-arm-kernel=archiver.kernel.org@lists.infradead.org vcpu_is_preempted() now can represent the actual state of the VCPU, so the scheduler can make better decisions when it picks the idle CPU to enqueue a task on. I executed a whole bunch of scheduler tests [0]. One particular test that shows the importance of vcpu_is_preempted() is AIO stress-ng test: x Disabled vcpu_is_preempted() stress-ng: info: [100] stressor bogo ops real time usr time sys time bogo ops/s bogo ops/s stress-ng: info: [100] (secs) (secs) (secs) (real time) (usr+sys time) stress-ng: info: [100] aio 222927 10.01 0.89 27.61 22262.04 7822.00 stress-ng: info: [139] aio 217043 10.01 1.00 26.80 21685.46 7807.30 stress-ng: info: [178] aio 217261 10.01 1.08 26.79 21709.36 7795.51 + Enabled vcpu_is_preempted() stress-ng: info: [100] aio 432750 10.00 1.14 19.03 43264.33 21455.13 stress-ng: info: [139] aio 426771 10.01 1.09 18.67 42629.13 21597.72 stress-ng: info: [179] aio 533039 10.00 1.42 20.39 53281.70 24440.12 Signed-off-by: Sergey Senozhatsky --- arch/arm64/include/asm/spinlock.h | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/arch/arm64/include/asm/spinlock.h b/arch/arm64/include/asm/spinlock.h index 9083d6992603..6a390eeabe82 100644 --- a/arch/arm64/include/asm/spinlock.h +++ b/arch/arm64/include/asm/spinlock.h @@ -11,17 +11,20 @@ /* See include/linux/spinlock.h */ #define smp_mb__after_spinlock() smp_mb() -/* - * Changing this will break osq_lock() thanks to the call inside - * smp_cond_load_relaxed(). - * - * See: - * https://lore.kernel.org/lkml/20200110100612.GC2827@hirez.programming.kicks-ass.net - */ #define vcpu_is_preempted vcpu_is_preempted + +#ifdef CONFIG_PARAVIRT +extern bool paravirt_vcpu_is_preempted(int cpu); + +static inline bool vcpu_is_preempted(int cpu) +{ + return paravirt_vcpu_is_preempted(cpu); +} +#else static inline bool vcpu_is_preempted(int cpu) { return false; } +#endif /* CONFIG_PARAVIRT */ #endif /* __ASM_SPINLOCK_H */ -- 2.27.0 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel