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 3FF3BCD4F22 for ; Wed, 4 Sep 2024 15:51:24 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C66628D0250; Wed, 4 Sep 2024 11:51:23 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C18C96B0106; Wed, 4 Sep 2024 11:51:23 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AB6E38D0250; Wed, 4 Sep 2024 11:51:23 -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 890A46B00BE for ; Wed, 4 Sep 2024 11:51:23 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 45BE9AAE11 for ; Wed, 4 Sep 2024 15:51:23 +0000 (UTC) X-FDA: 82527495246.22.7FE462C Received: from mail-ot1-f45.google.com (mail-ot1-f45.google.com [209.85.210.45]) by imf18.hostedemail.com (Postfix) with ESMTP id 5DD6B1C0020 for ; Wed, 4 Sep 2024 15:51:21 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=linaro.org header.s=google header.b=TODfepL6; spf=pass (imf18.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=1725465057; 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=yKMS4rvdXYfWNZhahV5vA8q9IrV0MiwByhfPud5Mz+I=; b=iFePJl62SkDfIOJlfbQvI2wb8yl9Pq9dkxn1NTtK2+DUBnlpJWeZH0NAKmgmS9TcqJNz7Q +pbiTxjsz+xub5TJGd3sIQYvSdlKqidyLkukYx/PaR62/nAVLi174mOpLa4yMHVRhV1b4v eJwfPJFMaRbzLZutW7ihKBwZvQgGG2o= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=linaro.org header.s=google header.b=TODfepL6; spf=pass (imf18.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=1725465057; a=rsa-sha256; cv=none; b=GDg8Qnvvm2hSmzfDvvVcQvaor4kOLfXydslSuMtnPMJC2mfo0ioJkNZsmW348Dh2AKzieu cPtodiahIYLSSD5ASYeFWWX0tR6+hJYtJHQV4fjAMCXY0hQtAEyjm0dsDwtoM1IKKDuqRe cet2zV/jj4DB7ay4rTTva3u2WD2fYhg= Received: by mail-ot1-f45.google.com with SMTP id 46e09a7af769-70f59e5419eso415965a34.3 for ; Wed, 04 Sep 2024 08:51:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1725465080; x=1726069880; 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=yKMS4rvdXYfWNZhahV5vA8q9IrV0MiwByhfPud5Mz+I=; b=TODfepL6iaiVp3jIwNJpPIAmE7Qusr3HiVF6WuCngbsoLr+4wxsh6v+nnLuG+glMc6 bTXLtJ0Bk21vy0YW2aoR6Pn9vWbbCofwrs40k+CILhbL1JGIXpDrDD65Ih5oMnPVIipZ aI7sE37vJdNfuX1l1s4e9XIRkPutvBxLKmztxIecklvhYxyLWbArU/h3JWbXVtH8SsJC CDJYAB02wfQJKO+XUygmtK/K5Ad6rkL1AMAr0YinrjA7ZG/M2KF+VVBMZz7DkizQGZUk 2+UtRPCr8ImtahvuRk1JAvYtd3EDYqcXXwM4T14gxcSQyYPp8TVVmqoJb2XgkHieUoGp U1EA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725465080; x=1726069880; 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=yKMS4rvdXYfWNZhahV5vA8q9IrV0MiwByhfPud5Mz+I=; b=WwSmxl3rLM+TXMO7uusxaOG4/qj9UFHgRc4YXB7Sl/HF5QXFbH4hLMNN4qkPrccAK3 /K9tUSS87CxjBdUWu/PMCz6Zqx2Gt5/OtSpr2/aYebWT/Ch5cmEhEHlMRnSMEIQ19BvF Bvmk5AuYrplYCay+bLLzdgBpNVriBHyzsHKTRqJIDi08mJXcMlUSU5Ih9iS35nrfmO6Q x0LRZUQPM4TuU9Lk5L3kW0dZ9pCxgdpy+/lV9PY9ZWmtz7hyJcW/Q6BFCfp6hWGPISlI jvKL5EB0j26y6dY3mydWfeI6bHL4knpuA9DXvyOpgGruC3UJyUE7I9fm4Cxg12Vp56Up 1A7w== X-Forwarded-Encrypted: i=1; AJvYcCXTF+6L0GSBNwJQmEZ1VRJiPg9GK+ZnXiltPoP1xwoz67NNNmuPZbVIbXUSvoziZcFnFRElX2fUgw==@kvack.org X-Gm-Message-State: AOJu0YzEXut15B8GrT033RhUdjK0XOj9/07ffgTjQEDBTVBi4OlEazlB XwmrGDdE5/ppTCWDhc9A2rVjkxW8DfvD15INtkz+N6+zCeKR65TE/A+6DMKqZrdRoMjQcxBPQHa 54YmE/jXipP83vZ3smhggsMUGdOwV3hhQoEbwBg== X-Google-Smtp-Source: AGHT+IHFEca56n9mOvv4LLooYyEvcZfkC1nHeTPqDpSwSqfjsY+MFpRuBtREaLkDBbM7XTkZms/F3Yb/3SaX9HtKA3Y= X-Received: by 2002:a05:6830:6c16:b0:704:4987:2342 with SMTP id 46e09a7af769-70f68671388mr10684065a34.3.1725465080286; Wed, 04 Sep 2024 08:51:20 -0700 (PDT) MIME-Version: 1.0 References: <273ee480-76b4-4b57-a95b-2849fe394bc0@redhat.com> In-Reply-To: <273ee480-76b4-4b57-a95b-2849fe394bc0@redhat.com> From: Anders Roxell Date: Wed, 4 Sep 2024 17:51:09 +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-Rspam-User: X-Stat-Signature: x5agkxkjoqia38q7rcink999huprecco X-Rspamd-Queue-Id: 5DD6B1C0020 X-Rspamd-Server: rspam11 X-HE-Tag: 1725465081-151556 X-HE-Meta: U2FsdGVkX18rHAbypml7VAH2inLCNCdXU5mqh/YV+p7+TYF9TSDbunUgxZ7ZRz8ul6U0/o1w+zvMGsiJmP/Jsj9DxdkVwRd4wJA5hjapGW0GICFJu0HXb4n13htx/WmfBBDivV58yq/FLG44PLWYxh4t02jM3kS4mrMbLnD60VJBJe7EE2Xxc5Ds6Wt2c5MxdDvj2C9iLi0S0lXrUduWVbI5WoAwf8V+ACJDzlpN25EqrhObx4qonEHt2Zee44sUkRv+hQt5yopdVD/U94xNX1yhP2mSoZXbwBP7DcLAO91561uFcuy7Kc+x9ud20r+7a/2AXoDu0HFroJMV52TxEYhrlaDlidQaIB8I52OftLev/PiReRV1yDf/38+MM1e5IXr6wvjRJUknbwPbbVVdGMpCjxYr2ELRIfohHA6mhBpaITaU/nlZqSzCpDozy5FjMAv9r7lmXFg3WU4+D6qRe4P38up0JWIUzbVo6SUKlTNRjhthKdixkzMQ02ozPse6xyoH9pz/V2zFPVzNGkU0ss9g2e7TR99Msvmj9DXvKtFBT7l2B8FAbctC/9AzdDJ8876tbxoaS3hZjleelWsxAmsA+czWmSgrPvZzKsKSSkA9ez84uwnqsU01JnJNcwRJ5tLfad5r6JdB+ZFiyjRRHbnl8AaDnXjlD/ANegmx/E6CezdA983kXCfc2Y70u3LHcddzcYKeh6/N0xxMREaebOvDOviq1zv5cjxymlniWWz/VSg64EuRzCsD97s2nXlggc5QCfSj/kzIebHGHiWD2M6byRPnv3psCVtEPm1kdI3cYAxzBh5XzbOErS8xN5gr/VJAEgZQ6bGP7bDOhY7Bw+vXWreaccPVhjzE0JJSkN0+1AKzIrE88DDtD2NewucevSTvCPy95ECQfKRRT1W703/kqPwR6bS9OMakZB0jVwYnsEbmeaSRw2kHvlnatseWirNy9wiuJPzfU0ceIw3 CydTTew5 wz9CqUSgqAA/I/nVz5hkEwOXbguCI8W2ROLjeUPYa7TaU8iaMQ+Go3i+tpbgsUiuse0XnlPt+fHe6bPFam9lGyoJP6DHir6eSw9VDZ7ix/6cgmft6N++LxiTiNSGQanFKA9Xq+b+8tY76nGwIPEaE+LHCt6RIZWHCXwi2+L0vRfFWKNt4bDJkXnvUbQ== 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 Wed, 4 Sept 2024 at 15:47, David Hildenbrand wrote: > > On 04.09.24 12:05, Anders Roxell wrote: > > On Tue, 3 Sept 2024 at 14:37, David Hildenbrand wrot= e: > >> > >> On 03.09.24 14:21, Anders Roxell wrote: > >>> Hi, > >>> > >>> I've noticed that the futex01-thread-* tests in will-it-scale-sys-thr= eads > >>> 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, indic= ating > >>> there is no scalability issue, just a minor performance overhead= . > >>> * The test doesn=E2=80=99t involve actual futex operations, just dumm= y wake/wait > >>> on a variable that isn=E2=80=99t accessed by other threads, so t= he results might > >>> not be very significant. > >>> > >>> Given that this seems to be a minor increase in code path length rath= er > >>> than a scalability issue, would this be considered a genuine regressi= on? > >> > >> Likely not, I've seen these kinds of regressions (for example in my fo= rk > >> micro-benchmarks) simply because the compiler slightly changes the cod= e > >> 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 no= t > >> 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 = mainline > > v6.11-rc6 the patch does nothing and the performance is as expeced. > > Just so I understand this correctly: > > It fixed itself after v6.11-rc4, but v6.11-rc4 was fixed with my patch? I had to double check and no, on v6.11-rc4 with or without your patch I see the 2% regression. Cheers, Anders > > If that's the case, then it's really the compiler deciding whether to > inline or not, and on v6.11-rc6 it decides to inline again. > > -- > Cheers, > > David / dhildenb >