From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 8BEF63858D32 for ; Mon, 19 Sep 2022 09:25:20 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 8BEF63858D32 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1663579520; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=FyKAvPDRDXUGclTwjx5qfCPcM5HhGnjgZQxfSzUGXMY=; b=bzTKhU4+kdeBdQDmb3abvczkcMLgj7/P5KF8x6osb6/4u+MuLN1DgZpTd2psHM94XYsuCI 0v0DaVvnCj8fCWO/1IyxECnzQC6jJa2NBDYlNqf8J/eY5udO+05mSUUKRgD25GU777haes 9fHLf8SSoY0RYzuU/nk/vP233qTCkwQ= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-594-ebcBc4MaMiu_gMJVLHtNUA-1; Mon, 19 Sep 2022 05:25:17 -0400 X-MC-Unique: ebcBc4MaMiu_gMJVLHtNUA-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 08A7D1E68183; Mon, 19 Sep 2022 09:25:17 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.39.192.137]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C6FD1C15BA5; Mon, 19 Sep 2022 09:25:15 +0000 (UTC) From: Florian Weimer To: Jakub Jelinek Cc: Jason Merrill , Michael Matz , gcc-patches@gcc.gnu.org Subject: Re: [PATCH] libgcc: Decrease size of _Unwind_FrameState and even more size of cleared area in uw_frame_state_for References: Date: Mon, 19 Sep 2022 11:25:13 +0200 In-Reply-To: (Jakub Jelinek's message of "Mon, 19 Sep 2022 09:58:30 +0200") Message-ID: <87czbrhg1y.fsf@oldenburg.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-5.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: * Jakub Jelinek: > The disadvantage of the patch is that touching reg[x].loc and how[x] > now means 2 cachelines rather than one as before, and I admit beyond > bootstrap/regtest I haven't benchmarked it in any way. Florian, could > you retry whatever you measured to get at the 40% of time spent on the > stack clearing to see how the numbers change? A benchmark that unwinds through 100 frames containing a std::string variable goes from (0b5b8ac5cb7fe92dd17ae8bd7de84640daa59e84): min: 24418 ns 25%: 24740 ns 50%: 24790 ns 75%: 24840 ns 95%: 24937 ns 99%: 26174 ns max: 42530 ns avg: 24826.1 ns to (0b5b8ac5cb7fe92dd17ae8bd7de84640daa59e84 with this patch): min: 22307 ns 25%: 22640 ns 50%: 22713 ns 75%: 22787 ns 95%: 22948 ns 99%: 24839 ns max: 52658 ns avg: 22863.4 ns So 227 ns per frame instead of 248 ns per frame, or ~9% less. Moving cfa_how after how in struct frame_state_reg_info as an 8-bit bitfield should avoid zeroing another 8 bytes. This shaves off another 3 ns per frame in my testing (on a Core i9-10900T, so with ERMS). The REP STOS still dominates uw_frame_state_for execution time, but this seems to be a profiling artifact. Replacing it with PXOR and seven MOVUPS instructions makes the hotspot go away, but performance does not improve. Odd. Thanks, Florian