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 3CF70C433FE for ; Thu, 3 Nov 2022 17:36:18 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D029E6B0072; Thu, 3 Nov 2022 13:36:17 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id CB2996B0073; Thu, 3 Nov 2022 13:36:17 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B2C746B0074; Thu, 3 Nov 2022 13:36:17 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id A3E806B0072 for ; Thu, 3 Nov 2022 13:36:17 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 72C3F161458 for ; Thu, 3 Nov 2022 17:36:17 +0000 (UTC) X-FDA: 80092834794.20.8EF14C8 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf24.hostedemail.com (Postfix) with ESMTP id 18D9B180006 for ; Thu, 3 Nov 2022 17:36:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1667496976; h=from:from: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; bh=wqHDCfVM36OPNbloym/8DLeITW3uuDn/ofViGZw+9QU=; b=Af2JbvfVK72SpTsKzI73olrHiTdTGBYorXzLjcW4LLaX9nf4JpLywmpiKtMZQtd22339UR NiRpVgkr1Tmqxr21XGCHpy5R5ro/aL8kWyLK8XTUmJbKqqLdbuQBwQ11sJjfFTOkVj2Ua6 H3qzumlK5cKy9/HWhqqzNv8iA6XsW6o= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-479-uX0kycl0N_CBvJKhPbl96Q-1; Thu, 03 Nov 2022 13:36:13 -0400 X-MC-Unique: uX0kycl0N_CBvJKhPbl96Q-1 Received: by mail-wm1-f72.google.com with SMTP id 189-20020a1c02c6000000b003cf8e70c1ecso151690wmc.4 for ; Thu, 03 Nov 2022 10:36:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:organization:from:references :cc:to:content-language:subject:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=wqHDCfVM36OPNbloym/8DLeITW3uuDn/ofViGZw+9QU=; b=iOwqBiATm0h3TpJ8jT312FzpMsQ/pmdB/8++JEvnaNGCOvefJhc3Jvy4mOVMDP/m9q wpYGRkSxzHSwFh4nuPIZiGFYP9QH5FCBMFIZVHd1ZiMbwhKA5q4+qd43TeSJtuIzhZTE mnopZJUvPZH5+iAGeuwkDYhRiiVTz5QntYavgmORmHkfribnaNvuyfB07YMKm3jBYLMX up7V7umSC2/TybLUE6gKRTk/3vuvHKHhpPl1DHnWiii2xkIr8C/DIM7ql3uggLeK2oMh e8QARxQ7lh3ohM2AePIORKyFxRhjWdtn5qWsBCQWkHmhS08fNVpGMuWL+EDJ8jYQBI4q uF6g== X-Gm-Message-State: ACrzQf2Nw9QZQQSbpZhk9Snb4k865SDBTmMWUcIVPrmL4RIGmkYXxe7t ZR6vRNABviwSLb2I4gcOVCvOlUVmm2llhmlGWpqrgyQfcQRRROrWfG2rgC2X/i6zH2fETfAeq2O hdvIllRmlE0M= X-Received: by 2002:a5d:4c43:0:b0:236:547f:bd3c with SMTP id n3-20020a5d4c43000000b00236547fbd3cmr20124906wrt.380.1667496972001; Thu, 03 Nov 2022 10:36:12 -0700 (PDT) X-Google-Smtp-Source: AMsMyM54lgh3dosJh+SDteCIDf+oND5iNc6bun/TfT30kj1hNLHlkbIfHxe0Djb4bu9ZHb48FSA7qw== X-Received: by 2002:a5d:4c43:0:b0:236:547f:bd3c with SMTP id n3-20020a5d4c43000000b00236547fbd3cmr20124874wrt.380.1667496971580; Thu, 03 Nov 2022 10:36:11 -0700 (PDT) Received: from ?IPV6:2003:cb:c707:a400:e2d7:3ee3:8d35:ac8? (p200300cbc707a400e2d73ee38d350ac8.dip0.t-ipconnect.de. [2003:cb:c707:a400:e2d7:3ee3:8d35:ac8]) by smtp.gmail.com with ESMTPSA id bq7-20020a5d5a07000000b0022e035a4e93sm1379834wrb.87.2022.11.03.10.36.10 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 03 Nov 2022 10:36:11 -0700 (PDT) Message-ID: <3259ad30-c129-84fc-9643-0aeaeeb3c806@redhat.com> Date: Thu, 3 Nov 2022 18:36:09 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.0 Subject: Re: mm: delay rmap removal until after TLB flush To: Linus Torvalds Cc: Peter Zijlstra , Will Deacon , Aneesh Kumar , Nick Piggin , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , Nadav Amit , Jann Horn , John Hubbard , X86 ML , Matthew Wilcox , Andrew Morton , kernel list , Linux-MM , Andrea Arcangeli , "Kirill A . Shutemov" , Joerg Roedel , Uros Bizjak , Alistair Popple , linux-arch References: <47678198-C502-47E1-B7C8-8A12352CDA95@gmail.com> <140B437E-B994-45B7-8DAC-E9B66885BEEF@gmail.com> <4f6d8fb5-6be5-a7a8-de8e-644da66b5a3d@redhat.com> From: David Hildenbrand Organization: Red Hat In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1667496977; 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=wqHDCfVM36OPNbloym/8DLeITW3uuDn/ofViGZw+9QU=; b=YVZ0hpI7/EOJxKlw4kI6owMaIQmAAe1NPulIhpBshynQAoSZ9FF9Q/NFAumf4nxr5/Qos1 Nutxw0nucGdVpR/D3ptYSaLZ1GhHbiGQHa+ynJU+F9w/yBnKlT+RDeS+XqdYRYxJZgWSgK 4KzKQnOFkGdZYD6/3XVfN7fptqkS0qI= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=Af2JbvfV; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf24.hostedemail.com: domain of david@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=david@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1667496977; a=rsa-sha256; cv=none; b=FGLsoEImoDICJjC+8Obnat1ci37HxZU175drkcjc+t9QbXxulhQ+DP4MQPLpHqVGsQQZ5X inP/2SCih9Wqj+im+fOcldPG8cNEBIRKHXzBRE0PjEAxu6FHua5EYkJXdMVdBTLcoh3dGo KAZfXbiIanYYurRFe6U2RKnGenAaIZA= Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=Af2JbvfV; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf24.hostedemail.com: domain of david@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=david@redhat.com X-Rspam-User: X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 18D9B180006 X-Stat-Signature: dbtd1od7ozf44zout4agtn1ob5sk9kyx X-HE-Tag: 1667496976-631277 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 03.11.22 18:09, Linus Torvalds wrote: > On Thu, Nov 3, 2022 at 9:54 AM Linus Torvalds > wrote: >> >> But again, those changes would have made the patch bigger, which I >> didn't want at this point (and 'release_pages()' would need that >> clean-in-place anyway, unless we changed *that* too and made the whole >> page encoding be something widely available). > > And just to clarify: this is not just me trying to expand the reach of my patch. > > I'd suggest people look at mlock_pagevec(), and realize that LRU_PAGE > and NEW_PAGE are both *exactly* the same kind of "encoded_page" bits > that TLB_ZAP_RMAP is. > > Except the mlock code does *not* show that in the type system, and > instead just passes a "struct page **" array around in pvec->pages, > and then you'd just better know that "oh, it's not *really* just a > page pointer". > > So I really think that the "array of encoded page pointers" thing is a > generic notion that we *already* have. > > It's just that we've done it disgustingly in the past, and I didn't > want to do that disgusting thing again. > > So I would hope that the nasty things that the mlock code would some > day use the same page pointer encoding logic to actually make the > whole "this is not a page pointer that you can use directly, it has > low bits set for flags" very explicit. > > I am *not* sure if then the actual encoded bits would be unified. > Probably not - you might have very different and distinct uses of the > encode_page() thing where the bits mean different things in different > contexts. > > Anyway, this is me just explaining the thinking behind it all. The > page bit encoding is a very generic thing (well, "very generic" in > this case means "has at least one other independent user"), explaining > the very generic naming. > > But at the same time, the particular _patch_ was meant to be very targeted. > > So slightly schizophrenic name choices as a result. Thanks for the explanation. I brought it up because the generic name somehow felt weird in include/asm-generic/tlb.h. Skimming over the code I'd have expected something like TLB_ENCODE_PAGE_BITS, so making the "very generic" things "very specific" as long as it lives in tlb.h :) -- Thanks, David / dhildenb