From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oo1-xc2f.google.com (mail-oo1-xc2f.google.com [IPv6:2607:f8b0:4864:20::c2f]) by sourceware.org (Postfix) with ESMTPS id C28B93858D33 for ; Mon, 4 Sep 2023 09:55:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C28B93858D33 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-oo1-xc2f.google.com with SMTP id 006d021491bc7-5734f54dc44so765347eaf.2 for ; Mon, 04 Sep 2023 02:55:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1693821338; x=1694426138; darn=sourceware.org; h=cc:to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=jWNJqr0OuLKZqFT7KO8QV69w2r2rMtKiq3P/onHbbXw=; b=VGThfO1A9CNt2Ddjh2zXe6dJVGnE84Hkay1Bq1+eHyyrG4URfKyisDlM9dRD7dNe1+ zWUuk0BhyyKcr+K1pZiCGbkHS4xDjs+XpR9Ev3juNwEMD4Zl+aCWlvqsEb/4VlAgCm3X 2bQ3WtKAYNs2gUWNYOfHP48aCj+FdPQWnRqSXmsLVwjud4yuTPvGpxFyf9bBwnrq2VQt GJXhFRoUeUTT/gIo3ZUeyteYDPZHkY3AQgdWxK5xpEsT7v3ZV7GHaoma8xf7cA2tmA1M cHASyqZ6bkrJOoxxN1Al1XQdIsODlREdHpa6L/qcE1gMiyYb0WmgASHadchj1mi9yAC5 A0wA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693821338; x=1694426138; h=cc:to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=jWNJqr0OuLKZqFT7KO8QV69w2r2rMtKiq3P/onHbbXw=; b=jWKRYXOvkpapIwmQxE8xqpx8+1hb3PW+UdAu064aOsPH29+RKdh5ABT3o1uKuoLCMs f8lpPHWhhiMi4jabD9vmQyLpu7KspcCeU0ab6c3b7Mq7heDwqENCh9OrPap+pnxoCZDf 4Coo0WyYQTBfiNqlIuYJRKJWuRyXtvfk7yV8xh3luq76WscbPnAsQ7EU1OepKlM8aEjM 4kj/pyY9Ppiv9H1CSfLVwDUmSoj38WJZCFxoXYNe56YtA0cHQxkcVycZIlePaZxh0Ioj 3BCTVWH/hN1toX45pFyfm77Lhjs6dHEZiIHCL7Y/Tbl7ddpiyiCYnEK1FLAj1T8aX66J uSGQ== X-Gm-Message-State: AOJu0YxdwtWgLYtZKfBe5ZEHATwC6haqxzNYKd+CCxrssF8ifwQrLYaZ gJsUcjUMTcsSHxsV1OH/aySup6+7UNnJLQmHcLgNR7515dM= X-Google-Smtp-Source: AGHT+IE1uPXkdbVp8lIVX5bIoWjo8XzzcDFtOqLS7Mt4sgA3/srrjr5M5BsHDDyalOBlE1z/W7tVwCr5XA/31jFxJ6o= X-Received: by 2002:a4a:2558:0:b0:570:fd05:7dc5 with SMTP id v24-20020a4a2558000000b00570fd057dc5mr7499154ooe.5.1693821337954; Mon, 04 Sep 2023 02:55:37 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a8a:60c:0:b0:4f0:1250:dd51 with HTTP; Mon, 4 Sep 2023 02:55:37 -0700 (PDT) From: Mateusz Guzik Date: Mon, 4 Sep 2023 11:55:37 +0200 Message-ID: Subject: fstat(2) penalized by using newfstatat(6, "", buf, AT_EMPTY_PATH) To: libc-alpha@sourceware.org Cc: Linus Torvalds , Adhemerval Zanella Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-0.0 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,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: Commit 4d97cc8cf3da ("io: Remove xstat implementations") reimplemented fstat entry point on top of newfstatat (as opposed to newfstat). This comes with a significant performance penalty as it induces a lot of work on kernel side to handle the path, which is additionally slowed down on x86-64 due to SMAP handling. Here are sample results from calling newfstatat vs newfstat on Sapphire Rapids: newfstatat 5088199 newfstat 8540383 (+67%) Are there any problems switching it back to newfstat at least for x86-64? If you want to bench yourself you can grab will-it-scale + https://github.com/antonblanchard/will-it-scale/pull/35/files + patch up one of the testcases to call newfstat directly: int error = syscall(5, fd, &sb); Note if you bench yourself and have a CPU significantly impacted by mitigations (e.g., meltdown) the difference may be very small in your setup. -- Mateusz Guzik