Received: by 2002:a05:7412:b101:b0:e2:908c:2ebd with SMTP id az1csp2822029rdb; Wed, 15 Nov 2023 11:27:29 -0800 (PST) X-Google-Smtp-Source: AGHT+IEAibPtq2wn42rAuVQ13nXIcJZlCQ8VDXaM9SU4+minzVB4EBf3kv9KG9yLQnuOnIJ+5k2M X-Received: by 2002:a05:6a20:e108:b0:187:962d:746b with SMTP id kr8-20020a056a20e10800b00187962d746bmr1494889pzb.9.1700076449063; Wed, 15 Nov 2023 11:27:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700076449; cv=none; d=google.com; s=arc-20160816; b=Tj5u+5M6NbvIHgUKy+87Rls7/ZswV6d1OUW87N35/92rdSRicfsjTZdJX/9LJk4Ei0 10p3IhGzznaBSVM8L/wko+WTbXPgwQIqkMvKpBRItDGYt3bsn7TFPy5doriDGeitNmYr FvXjIB/y3pgsGG3teIPIt2ymSohKJls60+5pS4qQAitOEAY6i9aSyZpTIV+Sz6aT7BI+ DAwJorBYFteYDino3qNu7iXYDf59dMdHZE3KACPMNrgMXIqLlQfluMBroPanCAbNzJqU lSjqaTSiJIv4wm0cM5sOOho8HryjpcFTVctr6szHUf74WMJLqVMq9dZ19oAM+yuPDtss /wqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=shjpDJFgEA7bY447zVelsVqtgQ9wtQbPGXjY7wm8MLo=; fh=O4rNFgBXe7gL1Xb5T7LcphrOPlFXf4AvwUu3ZeHYo34=; b=PjANoqkA3MR/3nfUKhr5v2c0LPIPX3oguajYq/Q7rFbS5deDFGzVQQU7IwAoe1B594 DDSc+4ciO0TwYDQlRoSR7c4nPzATjJjH8k1JJJtyPGhEw59DFh1bvQCh+tzF5HiSSymx KioW1lKe+4loxhxd+gAb7XwErsiNSVvVxWUuPHhDYX3OT5/EXGraEc/X/kOEW+S9Noie hw2Q4i5vM7tadKDvPDmqy5vO4LOoJeXtOaXXjK2uz+4JjWHwF2e5C+/OozwbRBQaZ0sw ZBYjjAmnyoo7Asgywyw/rC7yDu905UsqcIBQ0gszqwnO8otAErkAGMor8VIcJ7/EIi4P wziQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=TfcjMdv8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id y123-20020a62ce81000000b0068e29a05fa4si10174203pfg.326.2023.11.15.11.27.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Nov 2023 11:27:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=TfcjMdv8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id A37C68096FCE; Wed, 15 Nov 2023 11:27:17 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233899AbjKOT0q (ORCPT + 99 others); Wed, 15 Nov 2023 14:26:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55232 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233951AbjKOT0b (ORCPT ); Wed, 15 Nov 2023 14:26:31 -0500 Received: from mail-ej1-x629.google.com (mail-ej1-x629.google.com [IPv6:2a00:1450:4864:20::629]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EBD491AB for ; Wed, 15 Nov 2023 11:26:24 -0800 (PST) Received: by mail-ej1-x629.google.com with SMTP id a640c23a62f3a-9e62f903e88so4328766b.2 for ; Wed, 15 Nov 2023 11:26:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; t=1700076383; x=1700681183; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=shjpDJFgEA7bY447zVelsVqtgQ9wtQbPGXjY7wm8MLo=; b=TfcjMdv8W3ShLC3M03Es+pC07ZaE2B/imbUN0QLCywJpyz/MMWpAxAX6Z0M/V4ZSO4 Yg/Ol2gY0NcRh51IPAkRjKK6TvJJ1iWKLSS8WL1qvrtR6cE6xYaxCALuuQAVs9RchL8C nYJM1GxM2pX+XuJeethkfIu1QNxhABUVr7ivI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700076383; x=1700681183; h=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=shjpDJFgEA7bY447zVelsVqtgQ9wtQbPGXjY7wm8MLo=; b=b9a8yq7FdmlMWyIKU6Pp5FL91Vii5Y9Rg8iIm1OdndHmxw7oWSkq5WIUZcpPJmNhFm fv4Co0qR+kaA6cnGVMXLP7mOjKCTwjVRJui6eCMlvbIylJ3rQkGOVjlom1SmIBQb7xfZ a4woX5EagdUe5yedTV+/mIOPoQCIBGx/6f947goKc3dQGNKnUvu5j2G1rFTLVXJFph4z 9sr2FgzLkJR5kzcgWhRfvey07aoMvHG6oj5Mb+qBZjR99wj1Uy6CMlCQvdN15YOzEyvS zuT+QhUzP9sH3KJWflX8tuv8Yf3phAAPhKS0YKxHA4YNJBy2BcwOwFEkxCrf3to9QXjU BMDg== X-Gm-Message-State: AOJu0Yw2yEWOWett2zgspvRZOFawI0pwKw3Yyk4JivkXtdAYkqBkZBmU fTaUUHG8RvMZ6PalndE2WkWoYk5T7MPtisHzMPZiqL7a X-Received: by 2002:a17:906:855:b0:9ae:82b4:e309 with SMTP id f21-20020a170906085500b009ae82b4e309mr10044761ejd.0.1700076383315; Wed, 15 Nov 2023 11:26:23 -0800 (PST) Received: from mail-ed1-f43.google.com (mail-ed1-f43.google.com. [209.85.208.43]) by smtp.gmail.com with ESMTPSA id c7-20020a170906340700b009a9fbeb15f2sm7392726ejb.62.2023.11.15.11.26.19 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 15 Nov 2023 11:26:20 -0800 (PST) Received: by mail-ed1-f43.google.com with SMTP id 4fb4d7f45d1cf-5435336ab0bso68438a12.1 for ; Wed, 15 Nov 2023 11:26:19 -0800 (PST) X-Received: by 2002:aa7:d545:0:b0:543:6f8e:58ee with SMTP id u5-20020aa7d545000000b005436f8e58eemr8359172edr.41.1700076379472; Wed, 15 Nov 2023 11:26:19 -0800 (PST) MIME-Version: 1.0 References: <202311061616.cd495695-oliver.sang@intel.com> <3865842.1700061614@warthog.procyon.org.uk> <20231115190938.GGZVUXcuUjI3i1JRAB@fat_crate.local> In-Reply-To: <20231115190938.GGZVUXcuUjI3i1JRAB@fat_crate.local> From: Linus Torvalds Date: Wed, 15 Nov 2023 14:26:02 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [linus:master] [iov_iter] c9eec08bac: vm-scalability.throughput -16.9% regression To: Borislav Petkov Cc: David Howells , kernel test robot , oe-lkp@lists.linux.dev, lkp@intel.com, linux-kernel@vger.kernel.org, Christian Brauner , Alexander Viro , Jens Axboe , Christoph Hellwig , Christian Brauner , Matthew Wilcox , David Laight , ying.huang@intel.com, feng.tang@intel.com, fengwei.yin@intel.com Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Wed, 15 Nov 2023 11:27:18 -0800 (PST) On Wed, 15 Nov 2023 at 14:10, Borislav Petkov wrote: > > > Borislav, see > > > > https://lore.kernel.org/all/CAHk-=wjCUckvZUQf7gqp2ziJUWxVpikM_6srFdbcNdBJTxExRg@mail.gmail.com/ > > > > for some truly crazy code generation by gcc. > > Yeah, lemme show that to gcc folks. That asm is with your compiler, > right? Version? That was with gcc version 13.2.1. Note that I only see that crazy thing in lib/iov_iter.s, so I really do think it has something to do with inlining __builtin_memcpy() behind a conditional function pointer. In normal cases, gcc seems to just do the obvious thing (ie expand a small constant-sized memcpy inline, or just call the external 'memcpy' function. So it's some odd pattern that triggers that "expand non-constant memcpy inline". And once that happens, the odd code generation is still a bit odd but is at least explicable. That "do first word by hand, then do aligned 'rep movsq' on top of it" pattern is weird, but we've seen some similar strange patterns in hand-written memcpy (eg "use two overlapping 8-byte writes to handle the 8-15 byte case"). So the real issue is that we don't want an inlined memcpy at all, unless it's the simple constant-sized case that has been turned into individual moves with no loop. Or it's a "rep movsb" with FSRM as a CPUID-based alternative, of course. Linus