Received: by 2002:ac0:8c9a:0:0:0:0:0 with SMTP id r26csp5663752ima; Tue, 5 Feb 2019 16:12:58 -0800 (PST) X-Google-Smtp-Source: AHgI3IZEvC7CdFQr7nkuikbNQIum54FWMXrXioUOjrpuvzrpGjTqdSKwyaGMET9zwG1v9amahjkJ X-Received: by 2002:a63:6704:: with SMTP id b4mr7064777pgc.100.1549411978693; Tue, 05 Feb 2019 16:12:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549411978; cv=none; d=google.com; s=arc-20160816; b=zwbOtqO8j0v0vAtD/xkw7vUu1CBOIC8jrDhLj/QTvrXCe+/vWT3wxQWmOUMtDxKZ7H O9H67UuBRcer0hsoxbJBs2hqDK+UZ1lPPY4GkVCgWITZ0xAy6MXSz+QINPWwOADDvr5k FwzwIRLyeREZI9ZXDCmeuZgcIKWzagxxrTM27phSlgQOjx2Ka2vhSK0L17IWtInBeMPQ 5svnsFokr+0Hm1SzJennBcbRWQr8AAH4Isf8ATrPqpnl/4w3U4RajyKfOlmiLc2NCPQl YT0mtbqGUG3nwtqNmHLTvyODJdivpFP3bBIim3AGT5bJzN2CwK8zib+UXgECL3YwlgKB woYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=GF+co9nWNWjUN94BNpaB2aWNvW9wINEUuHWazMCNu6c=; b=F3HiucD2FZgDgxTgh69yuR7ldLp5r4WPnVuaCAkfOnm+jNyc/cbL5TVIFovTAvDBss woixbLPtr0XvADZzUYND221IRP679sHqvq79wRHUbDN/ub3CjJqoefgUsHOzudVrzEYQ z7s1vhp7ljFbCd0Q2u+fJ+O3TIPftGfdGksJjvSaceDvRl/O1T7o+U7nEqM+o2PJRIue YxLiRpIXGnEQDsa2zhCY4nVlcbdlYREvSONyHBYSwO2Be3E7gFM7xMj9qnUbd64KRCc0 bxouxObwxLDri3y3xZ+dCwwSlWjd0MgX3vzA+NkBVwELHeiPQP51I+oLcYR2rmv9f4SP 3eAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@arista.com header.s=googlenew header.b=U7EK2TeU; 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; dmarc=pass (p=QUARANTINE sp=REJECT dis=NONE) header.from=arista.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h17si4381078pgd.538.2019.02.05.16.12.43; Tue, 05 Feb 2019 16:12:58 -0800 (PST) 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; dkim=pass header.i=@arista.com header.s=googlenew header.b=U7EK2TeU; 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; dmarc=pass (p=QUARANTINE sp=REJECT dis=NONE) header.from=arista.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729858AbfBFAMM (ORCPT + 99 others); Tue, 5 Feb 2019 19:12:12 -0500 Received: from mail-ed1-f67.google.com ([209.85.208.67]:43215 "EHLO mail-ed1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729591AbfBFALw (ORCPT ); Tue, 5 Feb 2019 19:11:52 -0500 Received: by mail-ed1-f67.google.com with SMTP id f9so4446004eds.10 for ; Tue, 05 Feb 2019 16:11:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arista.com; s=googlenew; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=GF+co9nWNWjUN94BNpaB2aWNvW9wINEUuHWazMCNu6c=; b=U7EK2TeUZReQYTb1uPEAxx2qYhZuAlGn+nmICKWhAjon9K4ISRtNYo5NNQW7Lk6Ec1 aJ4P3jwEXjrkspiJOdiN14cyK9y5aLuDNmpmnaUq5RlTzseAMM10UtYQE5SL9mEnq8LV FBJq1lyr2g3nRrgbHqxTGzVgVi6BwzkObFH4m4YTwjlX5F/15O6cQ0hfttn7WCJUj7Ed iB2YHnfzrzQJnUdR/owhNtLZYDTFREDyAIs9zPBtLZf0qH8iAPqZtd96luo2gMKHeCn+ GtcUMgk/Vg8/1oZzfI0Tq8a7IQMIvFAQLD0t/c9jxvg7A/b21NjJGBXCE40bYthEXsF8 5pjw== 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=GF+co9nWNWjUN94BNpaB2aWNvW9wINEUuHWazMCNu6c=; b=t4DmRCfKhAtYHbIhLUQ9o3j35iXjeGbzyLvu8j8nynoFWiOK93MHdh8b7WHnyU+9/z A7bVHH1M8DxJIP+87yEPXcOFeOyWVYRbQmuPfDStjwZYJt5RXRv+WvMYldCsJRrNwr7/ s1TnSZdhbqzs+UdgTZJkQ4N8J8e5dNlHpmryiTG4rV+9bAIVtqmxB+SRYhR5C+F0Kkh3 ozvInzReDDC6pAKNO+4I83gSLaliGzXdQc3e67IMc/UiPG51AbD67aQr6Pba10afwERc e7mhQ7/rAaFeoumuCNgNnqhUHDSoc9WPy1OErKCK8kVeRI+7b0iSlKqacz1P+YE7JSMx nB8g== X-Gm-Message-State: AHQUAuZWN/mxp52jBej0c/d7vRRKURoSS5Iq4HDvPb2Zjze0imPxJfpx CFf1ZsqXI5sfBi+dr02pYvgqsf8Wh4s= X-Received: by 2002:a17:906:1686:: with SMTP id s6mr5302892ejd.209.1549411911072; Tue, 05 Feb 2019 16:11:51 -0800 (PST) Received: from Mindolluin.ire.aristanetworks.com ([217.173.96.166]) by smtp.gmail.com with ESMTPSA id p30sm5489594eda.68.2019.02.05.16.11.49 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 05 Feb 2019 16:11:50 -0800 (PST) From: Dmitry Safonov To: linux-kernel@vger.kernel.org Cc: Andrei Vagin , Dmitry Safonov , Adrian Reber , Andrei Vagin , Andy Lutomirski , Andy Tucker , Arnd Bergmann , Christian Brauner , Cyrill Gorcunov , Dmitry Safonov <0x7f454c46@gmail.com>, "Eric W. Biederman" , "H. Peter Anvin" , Ingo Molnar , Jeff Dike , Oleg Nesterov , Pavel Emelyanov , Shuah Khan , Thomas Gleixner , containers@lists.linux-foundation.org, criu@openvz.org, linux-api@vger.kernel.org, x86@kernel.org Subject: [PATCH 31/32] x86/vdso: Align VDSO functions by CPU L1 cache line Date: Wed, 6 Feb 2019 00:11:05 +0000 Message-Id: <20190206001107.16488-32-dima@arista.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190206001107.16488-1-dima@arista.com> References: <20190206001107.16488-1-dima@arista.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Andrei Vagin After performance testing VDSO patches a noticeable 20% regression was found on gettime_perf selftest with a cold cache. As it turns to be, before time namespaces introduction, VDSO functions were quite aligned to cache lines, but adding a new code to adjust timens offset inside namespace created a small shift and vdso functions become unaligned on cache lines. Add align to vdso functions with gcc option to fix performance drop. Coping the resulting numbers from cover letter: Hot CPU cache (more gettime_perf.c cycles - the better): | before | CONFIG_TIME_NS=n | host | inside timens --------|------------|------------------|-------------|------------- cycles | 139887013 | 139453003 | 139899785 | 128792458 diff (%)| 100 | 99.7 | 100 | 92 Cold cache (lesser tsc per gettime_perf_cold.c cycle - the better): | before | CONFIG_TIME_NS=n | host | inside timens --------|------------|------------------|-------------|------------- tsc | 6748 | 6718 | 6862 | 12682 diff (%)| 100 | 99.6 | 101.7 | 188 Measured on Intel(R) Core(TM) i5-6300U CPU @ 2.40GHz Co-developed-by: Dmitry Safonov Signed-off-by: Andrei Vagin Signed-off-by: Dmitry Safonov --- arch/x86/entry/vdso/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/x86/entry/vdso/Makefile b/arch/x86/entry/vdso/Makefile index 4e1659619e7e..2cac4660db05 100644 --- a/arch/x86/entry/vdso/Makefile +++ b/arch/x86/entry/vdso/Makefile @@ -4,6 +4,7 @@ # KBUILD_CFLAGS += $(DISABLE_LTO) -ffunction-sections +KBUILD_CFLAGS += -falign-functions=$(CONFIG_X86_L1_CACHE_SHIFT) KASAN_SANITIZE := n UBSAN_SANITIZE := n OBJECT_FILES_NON_STANDARD := y -- 2.20.1