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.129.124]) by sourceware.org (Postfix) with ESMTPS id 921713858C66 for ; Tue, 7 Mar 2023 11:51:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 921713858C66 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=1678189882; 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=uqzPCWx2TpvPXIDj4p+Qac30jbgepwUScrZ9y3XIUNo=; b=NfHJyiff7ay3jNTJk7AFZChzLapWNMDi4XLpIm+WAW8/Srze6l9uBkbkujFHD7+L7cQ/zv dYjHV1x8T8JP0tY+ZMy2LCRp42SYoqDS5jdNRV0AgrXWbPujcFZoJO5XW2yIhpIi+oPC5Q gmK928Jo6qlowOZ36+W5h3tHSE1e1O8= 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-9-O1b3vO6jNdS-cBCXDxGnsQ-1; Tue, 07 Mar 2023 06:51:20 -0500 X-MC-Unique: O1b3vO6jNdS-cBCXDxGnsQ-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 5ADEF2810C03; Tue, 7 Mar 2023 11:51:20 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.2.16.80]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 66EA92026D4B; Tue, 7 Mar 2023 11:51:19 +0000 (UTC) From: Florian Weimer To: Adhemerval Zanella Netto Cc: libc-alpha@sourceware.org, Bruno Haible Subject: Re: [PATCH] time: Use CLOCK_REALTIME for time (BZ #30200) References: <20230306160321.2942372-1-adhemerval.zanella@linaro.org> <87ttywq0je.fsf@oldenburg.str.redhat.com> <32a9fa9c-2714-9e18-a3e7-bcfc2d61cd87@linaro.org> Date: Tue, 07 Mar 2023 12:51:17 +0100 In-Reply-To: <32a9fa9c-2714-9e18-a3e7-bcfc2d61cd87@linaro.org> (Adhemerval Zanella Netto's message of "Tue, 7 Mar 2023 08:45:05 -0300") Message-ID: <87bkl4pyoa.fsf@oldenburg.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-4.9 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,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: * Adhemerval Zanella Netto: >> And of those original 17 ns, quite a bit is overhead from the >> benchmarking loop. I guess applications could work around it by having >> a background timer thread that increments a global variable and use that >> instead of the time function call, but that seems not a great approach. > > Yes, this is expected since time call will be route through clock_gettime. > Another fix would be to convince kernels developers to use CLOCK_REALTIME > on vDSO as well. No, that won't help. I think the crucial aspect for good x86-64 performance is that by using the time entry point, we tell the kernel that it does not have to obtain microsecond or millisecond precision. >> Based on previous feedback, I expect we'd have to carry a downstream >> revert of this patch indefinitely, so I'm rather strongly against >> applying it upstrean. > > To me it really seems like a over-optimization specially because 'time' > has only second resolution. I'm afraid that this will impact logging performance significantly in some scenarios. Thanks, Florian