From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id A58E5CA0ED3 for ; Wed, 4 Sep 2024 10:05:44 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2E6E06B0369; Wed, 4 Sep 2024 06:05:44 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 26F576B036A; Wed, 4 Sep 2024 06:05:44 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1106E6B036B; Wed, 4 Sep 2024 06:05:44 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id E4CA96B0369 for ; Wed, 4 Sep 2024 06:05:43 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 8B61D120F15 for ; Wed, 4 Sep 2024 10:05:43 +0000 (UTC) X-FDA: 82526624166.22.BBD330C Received: from mail-ot1-f45.google.com (mail-ot1-f45.google.com [209.85.210.45]) by imf09.hostedemail.com (Postfix) with ESMTP id 9E9D914000D for ; Wed, 4 Sep 2024 10:05:40 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=linaro.org header.s=google header.b=NKboRXyz; spf=pass (imf09.hostedemail.com: domain of anders.roxell@linaro.org designates 209.85.210.45 as permitted sender) smtp.mailfrom=anders.roxell@linaro.org; dmarc=pass (policy=none) header.from=linaro.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1725444264; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=CIEqtb0/9F1loSbNbXhveL3mObT0bYvJU/ZvAslsQR0=; b=DYaCSZgd8a0lKeGGa/8v6VfGbAG1osRjfwkvHLQnu63Nwe/+fRajFG2IXcL2mi+AWjo9km Qw5SSjqZcw5sIc9FGQ+5MbhzG2n9AzciK102FHnpxkJidwjyfmEmcMKLvDNjwzAYJLAnqT EL9LZqtQY7apNn088LPU5+jGmE3mxyg= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=linaro.org header.s=google header.b=NKboRXyz; spf=pass (imf09.hostedemail.com: domain of anders.roxell@linaro.org designates 209.85.210.45 as permitted sender) smtp.mailfrom=anders.roxell@linaro.org; dmarc=pass (policy=none) header.from=linaro.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1725444264; a=rsa-sha256; cv=none; b=t9jCVirHZp1o6U8xedQ2T3q7LwpQHcj1tw7BYPiZHPYXBA/F0VV6zRLZBxC5+1yUuY3w/k Rcf9cVPYTi6cMzZIVV5ulj4Po3z5X9FFHsfJcfsZexBD/j2jW5uo3uix4lhxZThW1CHIMk Nzygf5BRTgKmWsacn0jNEUIdw7/CL5E= Received: by mail-ot1-f45.google.com with SMTP id 46e09a7af769-70f6320ae4fso319416a34.2 for ; Wed, 04 Sep 2024 03:05:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1725444339; x=1726049139; darn=kvack.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=CIEqtb0/9F1loSbNbXhveL3mObT0bYvJU/ZvAslsQR0=; b=NKboRXyznQ7xqmg+TTkR/qNmqi9JnQIMiRAwbdFwhgQgdr6lzJBZvRCiAEH+CyK1CT oFfkNhUyHZgP2AJ7ILaHO2SenAklNC9IR/qT0yVaCfBqj63mgqffuAy17VIHe0s1MsU7 71GytCdZJ9+GvDYib7IKKDLR29l/n+BnsnZojrtt2/utXxq7vtRBZT5CFZercX6hQBNP bF6qo4GKHvyTs0w2bewYHVG0c8bu29IVZT4GqJV6ulfsNeAvf4aQRRkZUTdqRGUQ9gJV LUdJ//lTjhhDVD11ash+OT05yyPTwHeJ7IexJH/kkpy1fmCSOTMY4+0p4tb+VNn0xK+X mwGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725444339; x=1726049139; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=CIEqtb0/9F1loSbNbXhveL3mObT0bYvJU/ZvAslsQR0=; b=cxGreN5LEd03hTZZqMelZdisSF4CYyyhtDIDyj4MvHa8bh1CnPiJpGAZaK1oavVfze Lt6Vb0uCwLXYhvWoi+wZECVNbF8gllbr8FtR1FagWnvmO7QbAI43J3lBNtDutqyuDuwK cUA2s9TpGB8EHdSx8Z373LtY4Xppl86MCL7qK2tv0rWJWzh3+GhQcYfhxDzll4Jp+g2g QDBhXqrWr7W8EcWotV+SkzmRkMAm1WV9mWflNiE43lyVS+JPYBEwM0P3JU/EaVttpRQp E85UngqXeHaNY1wJqmTyqM50C/7/OOWQI9JrbcnNN34JNfyp9AW6CsN2yJJWwmCEEJRw WgMw== X-Forwarded-Encrypted: i=1; AJvYcCVNv89OPa/+LlnuT4XMnN9J4Eg/DdXJZYHcWXuWdb5RMJDRdTG0w5h2S/GTTkWe7p2y2wbloUVFIQ==@kvack.org X-Gm-Message-State: AOJu0YwEo+FyXSV81tFmGiJ6w3L06pb3llmxfVhOf12bGyWsuMRuwIZw tJRY0GoMaQdIya9IJxXDxUW1gyeVgg/DtOEg/yupqoqQD1xXpnC4Pr4YwKvJiYGLr7F7k4eEcB0 un/idZJnCgdjJ0wbIva+wpotFd/jdCZZ9msKXYA== X-Google-Smtp-Source: AGHT+IHKr3MA3hwPxyiGJmcFol57BYdcbd6OW2LBeXJN0l/coREJFmMP/eCrcFKSlEyU226769uZzSp2VNuZj862uw4= X-Received: by 2002:a05:6830:620f:b0:703:77c0:cedb with SMTP id 46e09a7af769-70f684a03cbmr10137918a34.1.1725444339557; Wed, 04 Sep 2024 03:05:39 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Anders Roxell Date: Wed, 4 Sep 2024 12:05:28 +0200 Message-ID: Subject: Re: Potential Regression in futex Performance from v6.9 to v6.10-rc1 and v6.11-rc4 To: David Hildenbrand Cc: Arnd Bergmann , Thomas Gleixner , Ingo Molnar , Peter Zijlstra , dvhart@infradead.org, dave@stgolabs.net, andrealmeid@igalia.com, Linux Kernel Mailing List , Linux-MM Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Stat-Signature: g6x3zw6xb5k9rdog6g1sys8p8j4a14ob X-Rspam-User: X-Rspamd-Queue-Id: 9E9D914000D X-Rspamd-Server: rspam02 X-HE-Tag: 1725444340-502960 X-HE-Meta: U2FsdGVkX18oyqSEK7W46WZEBpZ44mdUVdF/eR91LZ/UNZ7Sk5KXdzbaQ3ECTnGTQKbB5Ew1cJgTeLhtACuyNsoZOyIcuasPyqoT6pB9FZ2bR+cJVO750nEoaw6aTV7Ijf0vflwRd5ir0EQVPDwMfYDh+uwIXfob6raSCFqmfvXTctHx1AkEapSYWtrJ4LQ4xo6xYA8eXqTnP1eu1UfhG8fsA8SZXJXETIiL9M8P8YMleICNEzeB12hPVkAG+F17z/QshCnxNtLlzDmQyvTrGddYBsx9aOG8m48ncRFSHGIlxInBWrwpgiePB2LxiaF4ZKPsOYtR+s5PQleDs9BLP3/Ufd8TgwXbbrhhNnY6EYeFimNUeETRABTsAkFAiJWzGDFs/V2i07b6sFRjzAOIhKCSX820T8R4U+Jqh35JewNoRhm9cYcWuKeqxEW+/65B1GJd0aRRWa1hYbFQm3Im5g8cNR2YTL+rHRzd0ZYcjqltLQs7DqEKJTs79HqCKsKtRGOkmFnGmXuqG0X8rKXqfXNtrASbn3FDVLFNhNh9+93AFoqRtlPMx9VNMerWLhQ+iIzyLtH3ngyuw09A5UPXz5t/6goYSLc7HsGRqWecCnL8GBFAN7he4XS9XZ1tcZ4p4bzHGyRW0r5Bm6NuSWEnPrWu5JvhZk2V4Ud9IhT3w8UDBxN9O+nJEocYC1Coc2gXf8T0yvCqpztyFqbsyBbBOERBZT+da9zXaQ/oiAEpKgiXjRR0elgAt7nvs050hr7sLFUj09tlxqKcMkRcPG3vrmFCnnArt8uKr5fWIjQpjXQuvYKn48Iw58yHDPamaj833xuBzlAjaxcaVGisVqjNRlTCXn0GciHozUIxsMFhQEu149I2hT/drB2Utt6WZkc/XO3/9P0iZ6gGaYdYO+2iKfz2kdNz57h6w9SwX5CXcEk4uuVrhWn0BcExuoWC4gHp3WVUZH2Nf/s0hIz7gqP UbT+CVAD p7gOYTo5JDaUxK8DZZJo6jXjnIQa5dpNrSNgE8Gth2dPApHFDVRhLMWCJeArpW4TiLqcDZV7DPJns1ittClAXuoCjTNTlXAHPRRMAECqpw1iW8JIgUbNdxaCDqPiQgtzOSb9G5Bn/T+rVAwdLkMPzwYunmv6kTa/LnH6ivDK9UdYAwn7Sqx31mbZKYC3pohAHw4YYvzFzpAZpSWv3YPz/ShVtTw== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Tue, 3 Sept 2024 at 14:37, David Hildenbrand wrote: > > On 03.09.24 14:21, Anders Roxell wrote: > > Hi, > > > > I've noticed that the futex01-thread-* tests in will-it-scale-sys-threa= ds > > are running about 2% slower on v6.10-rc1 compared to v6.9, and this > > slowdown continues with v6.11-rc4. I am focused on identifying any > > performance regressions greater than 2% that occur in automated > > testing on arm64 HW. > > > > Using git bisect, I traced the issue to commit > > f002882ca369 ("mm: merge folio_is_secretmem() and > > folio_fast_pin_allowed() into gup_fast_folio_allowed()"). > > Thanks for analyzing the (slight) regression! > > > > > My tests were performed on m7g.large and m7g.metal instances: > > > > * The slowdown is consistent regardless of the number of threads; > > futex1-threads-128 performs similarly to futex1-threads-2, indicati= ng > > there is no scalability issue, just a minor performance overhead. > > * The test doesn=E2=80=99t involve actual futex operations, just dummy = wake/wait > > on a variable that isn=E2=80=99t accessed by other threads, so the = results might > > not be very significant. > > > > Given that this seems to be a minor increase in code path length rather > > than a scalability issue, would this be considered a genuine regression= ? > > Likely not, I've seen these kinds of regressions (for example in my fork > micro-benchmarks) simply because the compiler slightly changes the code > layout, or suddenly decides to not inline a functions. > > Still it is rather unexpected, so let's find out what's happening. > > My first intuition would have been that the compiler now decides to not > inline gup_fast_folio_allowed() anymore, adding a function call. > > LLVM seems to inline it for me. GCC not. > > Would this return the original behavior for you? David thank you for quick patch for me to try. This patch helped the original regression on v6.10-rc1, but on current main= line v6.11-rc6 the patch does nothing and the performance is as expeced. Cheers, Anders > > diff --git a/mm/gup.c b/mm/gup.c > index 69c483e2cc32d..6642f09c95881 100644 > --- a/mm/gup.c > +++ b/mm/gup.c > @@ -2726,7 +2726,8 @@ EXPORT_SYMBOL(get_user_pages_unlocked); > * in the fast path, so instead we whitelist known good cases and if in= doubt, > * fall back to the slow path. > */ > -static bool gup_fast_folio_allowed(struct folio *folio, unsigned int fla= gs) > +static __always_inline bool gup_fast_folio_allowed(struct folio *folio, > + unsigned int flags) > { > bool reject_file_backed =3D false; > struct address_space *mapping; > > > -- > Cheers, > > David / dhildenb >