Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp401776ybi; Fri, 21 Jun 2019 01:30:05 -0700 (PDT) X-Google-Smtp-Source: APXvYqzJ8QIv3BwBUCWqVIFKelZz3EWkB96Y3xgvyEe7iNn8UwcCszW5o6mDdvATcdH5W/7I9lek X-Received: by 2002:a63:364f:: with SMTP id d76mr16912965pga.147.1561105805014; Fri, 21 Jun 2019 01:30:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561105805; cv=none; d=google.com; s=arc-20160816; b=SzwK9uHv2yFvi/Nv5+4BMnr1LfpT5yxGBbQxUoKn8rbeJH1diyC9III8RbDoRkph3s ZCe2QS5iTQUItGvTvV2Vkww0jY8pSRRihx/zF/H/2geCRjyNYzp3SwOBpzVfBdy6NWTJ J3pwJmYfQ/gpK4TAnWYlCo8+dpbN5tIJPkJ8BzOowuOWlslPu7DCJhmVlt7ozmO3bFEb Q5SUoWUViCq/FYrLGF0NProNzyKdQq7uuIs2Rhf15R/3NnfeeuVQ3gBs3tyRd0OCLXn0 KuXsAZ02K8B9cckv0NL/8pIsLJkidgnQMffqmeZmJJtLXsJUGD8qi/vaQlTKWtJzfRZZ WBmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:message-id :user-agent:mime-version:in-reply-to:references:cc:to:subject:from :date:dkim-signature; bh=yxfaAKL36iRBk7i3lJUt2q8lAl7GH2S2sjM2Bw2uPJs=; b=IcrK9cBdHi1sOGu4cFNKpOfPWqXi4gbVj4kS/ty++9cwBWviKvEC7IZtlT/Xq1h3CM qbjyz5nP23tohW+ikw6UqzjLC4ieBv3g5Z6aObJq5QGMOZasOlg5n40XFpQZABAVz0M9 l0+PvDqKiYWSHYhnDSl/tMpGmnu1olnA4RBYOArmrFtfkgnIH9n+QTBEKFdIy1rdpz85 ebzpUkPT9s0qP2JvNpb1hV3CU6+BORKySnKFlm8S1Htb4eTluGlBD7X2aldj/fQkgjVv fAtQ7j23AXD9mM41YmDL6Nw3u1akh6CqvUkX4gRluwrtoCY+eCc6cnITmDVgwwTVOAQQ z12Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=fbj3ryUA; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z10si1900569pgv.233.2019.06.21.01.29.49; Fri, 21 Jun 2019 01:30:05 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=fbj3ryUA; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726412AbfFUI3j (ORCPT + 99 others); Fri, 21 Jun 2019 04:29:39 -0400 Received: from mail-pf1-f195.google.com ([209.85.210.195]:41868 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726210AbfFUI3i (ORCPT ); Fri, 21 Jun 2019 04:29:38 -0400 Received: by mail-pf1-f195.google.com with SMTP id m30so3204761pff.8; Fri, 21 Jun 2019 01:29:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:subject:to:cc:references:in-reply-to:mime-version :user-agent:message-id:content-transfer-encoding; bh=yxfaAKL36iRBk7i3lJUt2q8lAl7GH2S2sjM2Bw2uPJs=; b=fbj3ryUASSI5WTeqBy+Hc5OEHWiPYdV7sIZyNqgV+qzFiANsZYBHP3eTFrdbgDPMqz +NZAYlBR+Dfy7yY9SJaByfth0oz38I9M0oFx0/PjpOVh4PwNfZ6TM2OYoTtOR9SENi8J c4JwUKiwqGhPWDDJTo19f+iyU8hDWG4ED1a79bBPnMbmzbrs+wX6NcAW3qliBAqn2Cz9 cNxxEV7yL4Cgwr2k23ZRaqddTXmW7jlpNEyLek6w+pt1gX1BPnCgoRUSFo9HYLeo65pM jcwVL8KYaA8GxmgazJGRjU9ifPR/K7V+tvyC4gxu12oOVP2g9/tx3yANOSmbk/9lW3n7 hoKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:subject:to:cc:references:in-reply-to :mime-version:user-agent:message-id:content-transfer-encoding; bh=yxfaAKL36iRBk7i3lJUt2q8lAl7GH2S2sjM2Bw2uPJs=; b=Uo5FWFl6d27L/KKJjFoSEGyYN9YEHSsXrrHIqtIjPRFShcujK9ZxGISRMK70fetFV+ 2EICV2rp8ce7UHnd5OGFDoR5x3H38oa6txrDiuU8eJRX0kJ2fBLOUrMO0cMgGEyzgaLa koRjBdWYo2cIion2cUXd4V0WoohJbahmrHRiyqyHMUgs9LH2x+trzLlpvetgRZaV7FJD LS4R2l3CCRx9hIMxKU2/n6rtW8myrmgHsG142CxfiwX9fL54AmG0z2L6XSS7sBwp5fme EMaAdCikfAE6via71atFS9Kg3BtpvWmknrxKqVQAFyyfkzRzBDzZs16CVJs2qLn8Ptth v97w== X-Gm-Message-State: APjAAAWcVG1KAc5XJv4nWrF4ndq1DdZZGujF01VtChFPU/14zfCXX8Qq LDVQCcvc914/MuUdcBWwsag= X-Received: by 2002:a17:90a:cb15:: with SMTP id z21mr5012050pjt.87.1561105777693; Fri, 21 Jun 2019 01:29:37 -0700 (PDT) Received: from localhost ([1.144.138.41]) by smtp.gmail.com with ESMTPSA id v185sm2443015pfb.14.2019.06.21.01.29.36 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 21 Jun 2019 01:29:36 -0700 (PDT) Date: Fri, 21 Jun 2019 18:29:27 +1000 From: Nicholas Piggin Subject: Re: [PATCH 16/16] mm: pass get_user_pages_fast iterator arguments in a structure To: Linus Torvalds Cc: Andrey Konovalov , Benjamin Herrenschmidt , Rich Felker , "David S. Miller" , Christoph Hellwig , James Hogan , Khalid Aziz , Linux List Kernel Mailing , linux-mips@vger.kernel.org, Linux-MM , linuxppc-dev@lists.ozlabs.org, Linux-sh list , Michael Ellerman , Paul Burton , Paul Mackerras , sparclinux@vger.kernel.org, the arch/x86 maintainers , Yoshinori Sato References: <20190611144102.8848-1-hch@lst.de> <20190611144102.8848-17-hch@lst.de> <1560300464.nijubslu3h.astroid@bobo.none> <1561032202.0qfct43s2c.astroid@bobo.none> In-Reply-To: MIME-Version: 1.0 User-Agent: astroid/0.14.0 (https://github.com/astroidmail/astroid) Message-Id: <1561104674.cxm7sn77rx.astroid@bobo.none> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Linus Torvalds's on June 21, 2019 3:21 am: > On Thu, Jun 20, 2019 at 5:19 AM Nicholas Piggin wrote= : >> >> The processor aliasing problem happens because the struct will >> be initialised with stores using one base register (e.g., stack >> register), and then same memory is loaded using a different >> register (e.g., parameter register). >=20 > Hmm. Honestly, I've never seen anything like that in any kernel profiles. >=20 > Compared to the problems I _do_ see (which is usually the obvious > cache misses, and locking), it must either be in the noise or it's > some problem specific to whatever CPU you are doing performance work > on? No you're right, the performance hit from these flushes is not a big hit that stands out in cycle counts. I just look at kernel code for various flushes. Branches not surprisingly are usually the main culprit, but they're normally not so interesting. Static alias prediction seems to work well outside this case. It's interesting, you need both a store ; load sequence that does not predict well (e.g., using a different base register), and you also need that load to be executed ahead of the store. The small stack structure for arguments is the perfect case. Bad pattern, and load executed right after store. Even then you also need a reason to delay the store (e.g., source not ready or store queue full), but those hazards do show up. Now, even when all that goes wrong, there are dynamic heuristics that can take over. So if you run a repetitive microbenchmark you won't see it. Some CPUs seem to be quite aggressive about giving up and turning off the alias prediction globally if you take misses (Intel x86 used to do that IIRC, not sure if they still do). So in that case you wouldn't even see it show up in one place, everything will just run slightly slower. What I worry about is high rate direct IO workloads that see single flushes in these paths as significant. Or if this thing creeps in to the kernel too much and just slightly raises global misses enough, then it will cause disambiguation to be significantly shut down. Thanks, Nick =