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 6B93EC4332F for ; Fri, 21 Oct 2022 02:11:17 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id EDA5F8E0003; Thu, 20 Oct 2022 22:11:16 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E8AF98E0001; Thu, 20 Oct 2022 22:11:16 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D521C8E0003; Thu, 20 Oct 2022 22:11:16 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id C63B18E0001 for ; Thu, 20 Oct 2022 22:11:16 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 90C85120890 for ; Fri, 21 Oct 2022 02:11:16 +0000 (UTC) X-FDA: 80043329352.20.5B1A3D9 Received: from mail-qt1-f179.google.com (mail-qt1-f179.google.com [209.85.160.179]) by imf28.hostedemail.com (Postfix) with ESMTP id 3272CC000E for ; Fri, 21 Oct 2022 02:11:14 +0000 (UTC) Received: by mail-qt1-f179.google.com with SMTP id r19so844190qtx.6 for ; Thu, 20 Oct 2022 19:11:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=ASIrxtSBDsxk4HGQqbLDireIOxv7TbGHiig0CHntdSI=; b=d0RcTWc1MKBOhhT5dKEG1Usy/aOhsV4HKs+lZmjbd5YXaVGizlNl0Eie/W1sistU3G 5sKn7isal7vO0hl/3+xRKCOlZ1eBybkH73NcCluO/7XBbtsmJ6Fw5Wjx2PKGV4IR35QH +YloN2juFf0i7OOlQFZH+/wfTO9SBo0yFEw6E= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=ASIrxtSBDsxk4HGQqbLDireIOxv7TbGHiig0CHntdSI=; b=vD99T9AIL/U+9VKfdZ5It6haV5R4lNZ/Ry9AJYO5xl2CtRDlReMAt3qVNaZpZ7Q9mo ouhszR+7vxJZ3b5UZhV/9d22gzFI4suTMdPVJY8EgKCeoH/P1exdVBsy0V5VvtfduDLV vUVsnEdMhgacJCJqImC9Kh7Ttl/ppfO8Cw6rtL8ofXBH6ZKk1Abaz9tl2G4s9PpDBsJW BVK0fDXCDI9AhMmkt+lsYyq0tM3agyn4/6+yoqxJ/Vi+A6uEOKHEH3z7ZX0Um1imJEXA HQhOzU+8jxxcp/NsTXhbn90rz59kaWwvqO/GIql69pGoC20Aibz4QoGRKKdz9TrL6h0d urZQ== X-Gm-Message-State: ACrzQf2BUxd6meNpv4cWv6vjX3UtCLTYq3lMTVgMlYrO7zRwtV4YOtEb m+g60+fdzTawOc5bLWxFY90FvcjzEwxX6A== X-Google-Smtp-Source: AMsMyM5AQZhMtuKWfIqccyrXFTF5gO2LdYwrsUMYVaCmMUlk5mZsTmsET4IaamHn9tpa+KgcXfYEQw== X-Received: by 2002:ac8:5a56:0:b0:39c:ce5f:9f95 with SMTP id o22-20020ac85a56000000b0039cce5f9f95mr14150993qta.325.1666318274074; Thu, 20 Oct 2022 19:11:14 -0700 (PDT) Received: from mail-yb1-f180.google.com (mail-yb1-f180.google.com. [209.85.219.180]) by smtp.gmail.com with ESMTPSA id h19-20020a05620a401300b006eed47a1a1esm8927874qko.134.2022.10.20.19.11.13 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 20 Oct 2022 19:11:13 -0700 (PDT) Received: by mail-yb1-f180.google.com with SMTP id e62so1722748yba.6 for ; Thu, 20 Oct 2022 19:11:13 -0700 (PDT) X-Received: by 2002:a05:6902:1352:b0:6bb:3f4b:9666 with SMTP id g18-20020a056902135200b006bb3f4b9666mr13522092ybu.101.1666318263133; Thu, 20 Oct 2022 19:11:03 -0700 (PDT) MIME-Version: 1.0 References: <20220815071332.627393-1-yuzhao@google.com> <20220815071332.627393-9-yuzhao@google.com> In-Reply-To: From: Linus Torvalds Date: Thu, 20 Oct 2022 19:10:46 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v14 08/14] mm: multi-gen LRU: support page table walks To: Peter Zijlstra , "the arch/x86 maintainers" Cc: Yu Zhao , Andrew Morton , Andi Kleen , Aneesh Kumar , Catalin Marinas , Dave Hansen , Hillf Danton , Jens Axboe , Johannes Weiner , Jonathan Corbet , Matthew Wilcox , Mel Gorman , Michael Larabel , Michal Hocko , Mike Rapoport , Tejun Heo , Vlastimil Babka , Will Deacon , linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, page-reclaim@google.com, Brian Geffon , Jan Alexander Steffens , Oleksandr Natalenko , Steven Barrett , Suleiman Souhlal , Daniel Byrne , Donald Carr , =?UTF-8?Q?Holger_Hoffst=C3=A4tte?= , Konstantin Kharlamov , Shuang Zhai , Sofia Trinh , Vaibhav Jain Content-Type: text/plain; charset="UTF-8" ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1666318275; a=rsa-sha256; cv=none; b=COr7JTpyhMwO85AFYZG6kHZ7m7sqf2OqZoXzIzAkV6SsOCl09ucvAOAvVJHI2VKQBt/Ybl hgoRpOywU4r15jz2Ojokg1OoxgkJuhlQVAhUviL31LbZWOyVg6W45Q/NSSYto+RaeFehMA jFMjjFmPVjvFlNUEyCzst+TaDyZ3Iz4= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=google header.b=d0RcTWc1; spf=pass (imf28.hostedemail.com: domain of torvalds@linuxfoundation.org designates 209.85.160.179 as permitted sender) smtp.mailfrom=torvalds@linuxfoundation.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1666318275; 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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=ASIrxtSBDsxk4HGQqbLDireIOxv7TbGHiig0CHntdSI=; b=V6hxvEeergGc4UWPF9rSQ3WlwU/ZpOPTBwYUfiXregnE7j4UKvcLbPz6yRYdGBMBbcA19p w0U1zOapDw9g56+HHSHo1NDaoX9AET7o6TG28e5bhsS+OD6zDAvrvaCkYDJX+/6pmAmSt8 sHm1AkfmpHxibcHDU9sfUHiiT/n70dk= X-Stat-Signature: 8eitz7guz1f38z4p5urbu5ds4o4djkn5 X-Rspamd-Queue-Id: 3272CC000E Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=google header.b=d0RcTWc1; spf=pass (imf28.hostedemail.com: domain of torvalds@linuxfoundation.org designates 209.85.160.179 as permitted sender) smtp.mailfrom=torvalds@linuxfoundation.org; dmarc=none X-Rspam-User: X-Rspamd-Server: rspam05 X-HE-Tag: 1666318274-84867 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: On Thu, Oct 20, 2022 at 11:55 AM Peter Zijlstra wrote: > > On Thu, Oct 20, 2022 at 10:35:28AM -0700, Linus Torvalds wrote: > > That said, I reacted to that cmpxchg loop: > > > > } while (cmpxchg64(&pmdp->pmd, old.pmd, 0ULL) != old.pmd); > > > > is this series just so old (but rebased) that it doesn't use "try_cmpxchg64()"? > > Yep -- it's *that* old :-/ You're not in fact the first to point that > out. > > I'll make time tomorrow to fix it up and respin and send out. This is as > good a time as any to get rid of carrying these patches myself. Hmm. Thinking some more about it, even if you do it as a try_cmpxchg64() loop, it ends up being duplicated twice. Maybe we should just bite the bullet, and say that we only support x86-32 with 'cmpxchg8b' (ie Pentium and later). Get rid of all the "emulate 64-bit atomics with cli/sti, knowing that nobody has SMP on those CPU's anyway", and implement a generic x86-32 xchg() setup using that try_cmpxchg64 loop. I think most (all?) distros already enable X86_PAE anyway, which makes that X86_CMPXCHG64 be part of the base requirement. Not that I'm convinced most distros even do 32-bit development anyway these days. (Of course, if we require X86_CMPXCHG64, we'll also hit some of the odd clone CPU's that actually *do* support the instruction, but do not report it in cpuid due to an odd old Windows NT bug. IOW, things like the Cyrix and Transmeta CPU's did support the instruction, but had the CX8 bit clear because otherwise NT wouldn't boot. We may or may not get those cases right, but I doubt anybody really has any of those old CPUs). We got rid of i386 support back in 2012. Maybe it's time to get rid of i486 support in 2022? That way we could finally get rid of CONFIG_MATH_EMULATION too. Linus