From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS31976 209.132.180.0/23 X-Spam-Status: No, score=-3.9 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id BF7A21F461 for ; Mon, 2 Sep 2019 19:31:37 +0000 (UTC) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:subject:to:cc:references:from:message-id:date :mime-version:in-reply-to:content-type :content-transfer-encoding; q=dns; s=default; b=MGtZTNTAj+o5/OJH kgAT/zIECyrC1mq94y3Nl8k5QpYzp+rfz9mOhcU3wT7cMx+eeipmqapBvUgiRCpp G4F8ocj9ezQz0mkWpqSAtQriWkEF7DNL8Ogxn093RAJ0k+WBcULMp8nnM8IH29tM hMsPTtKr5u83Rdh5nLUViJTpNkM= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:subject:to:cc:references:from:message-id:date :mime-version:in-reply-to:content-type :content-transfer-encoding; s=default; bh=pr22RCNzkLd30364uQF/7Y Oz7U4=; b=Ci6x3DFHtoC9Z9iS2+VZrKtdoHdU4otK5XtmTApmeQa8RYGXAO6oR6 gCKx3GiMgyW5D9tg8XIKQKB73oYTnmPayUBfQvd1lnSuDCmrABPngL3jzX1AjpGO r6KZSO8X4SZ8mfC1d9wON4xw7SGC7W61wh7thnYOCcLz4ek08MbN0= Received: (qmail 91504 invoked by alias); 2 Sep 2019 19:31:35 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Received: (qmail 91490 invoked by uid 89); 2 Sep 2019 19:31:35 -0000 Authentication-Results: sourceware.org; auth=none X-HELO: mail-qk1-f196.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:cc:references:from:openpgp:autocrypt:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=HG9hTbSwXloFO09tIHKSkb5cltDmROe97Umt+pEIiag=; b=Ku9PFQucu2i7UJKJBUKnHLthyysNhd7L5ifXfGbixwSrDjitTK9oVRqzYiVehKF5Lu XQgOb1YVJN2UJEQLigutZvVjwoofw3ryS3sDZzxdDnWgai/JJXMTV720r24JgTgrox9T ug8LQHeG68dWEccF+WAwWk2lUEFgmDb0N2h5c6N/JlYq3pME5DxEdbdQHDVCHlDCBWJv 1qXliMLzgXz4c7UziGt2yltAdt3ax+MKoYyT6r/ilIjXxcsLAOenEGIjT2KM30DFRgfd VpGAtscHKK0J2jNQXeV6DcrmZ7fMX/fCmShlYCyby4JawxxT+iob4navzUkFHdtlEphy Dfcg== Subject: Re: [PATCH v2 08/10] Use clock_gettime to implement gettimeofday. To: Florian Weimer , Zack Weinberg Cc: libc-alpha@sourceware.org, Joseph Myers , Lukasz Majewski , Alistair Francis , Stepan Golosunov , Arnd Bergmann , Samuel Thibault References: <20190828153236.18229-1-zackw@panix.com> <20190828153236.18229-9-zackw@panix.com> <87imqhb0wi.fsf@oldenburg2.str.redhat.com> From: Adhemerval Zanella Openpgp: preference=signencrypt Message-ID: Date: Mon, 2 Sep 2019 16:31:25 -0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <87imqhb0wi.fsf@oldenburg2.str.redhat.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit On 28/08/2019 15:27, Florian Weimer wrote: > * Zack Weinberg: > >> Remove sysdeps/unix/clock_gettime.c, which implemented clock_gettime >> using gettimeofday; new OS ports must provide a real implementation of >> clock_gettime. > > This comes at a performance cost. On a Xeon Gold 6126 with Fedora 31's > 5.3.0-0.rc5.git0.1.fc31 kernel, I see 17.6 ns per gettimeofday call > before this change, and 19.6 ns afterwards. > > Part of that is the additional overhead of the functional call and the > clock check. I think gettimeofday should call directly into the vDSO. > > Another part according to profiles is the downscaling of the nanoseconds > value. TIMESPEC_TO_TIMEVAL does not tell GCC that tv_nsec member does > not use the full long range, so GCC emits a full 64-bit division (with a > multiplication and shift). > > Both changes will hopefully recover the performance loss. As for time patch from this set, I think we can still make the *default* gettimeofday implementation use the clock_gettime if the architecture does not have a faster way to accomplish it (through vDSO or the ifunc trick to reduce latency). It would allow each arch-mantainer to set if or when the architecture will move generic implementation and cleanup the optimized glue. My view is we can use my proposed patch to refactor gettimeofdat [1], and change the fallback syscall path to call clock_gettime instead. I can work towards the modification. [1] https://sourceware.org/ml/libc-alpha/2019-07/msg00158.html