Received: by 2002:a05:6358:111d:b0:dc:6189:e246 with SMTP id f29csp1919475rwi; Thu, 3 Nov 2022 10:29:27 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4/qJq8EpHIJkU2rQh/Y4cTVKh18Hato8VnllmLWVdkpwL1F8GahVAubCjk1kwuFrvHHkC1 X-Received: by 2002:a17:906:7212:b0:7ad:bd4b:c41f with SMTP id m18-20020a170906721200b007adbd4bc41fmr26755324ejk.659.1667496567552; Thu, 03 Nov 2022 10:29:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667496567; cv=none; d=google.com; s=arc-20160816; b=ZKmG9fCr00G6MNAB/tmQdDxLO8DZ4oTd0x4amhrHo8IB3kXaNw+miwtg8Q6Iau7M3b ZBWoqJhwNz4Oj1dn5BnKQoqV7IyMDWiZc+w5QFUT7ayMpI9fdgE5PPkfbpMYoRFaUt1a YD6PJsa7sl+nWFn5zuTRYV85rI5JBwXPFTcqBXnckhJzVKrHkZgQy2qYsjvc6T65PkYk G24KfEVKAHakqtHvHkqK/EHxNk18Vy8gDadSI2fWd8SvQRvvWB1DNYuVhRX7m/Npfaj9 /z1yT+OlbhfXbM9Y7PwOz07hkrXfExuf6ZZn/ePAIkFAPmZfjCByO/LeCSSHLYG04WGD SstQ== 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=JxCfvbb+eoelACSav5gOVJGA8b7JZzX3u9t6lpOqhGc=; b=lvKNjSiXIot3bp2qEhHBaxF5NfNW67+3Cnao9jM2gbLLMNyePcrILV30iWd+KfW0zm H8FRP0o+dQihAHZYoT+SM+i+3smQvNYdKWQJ79e8IeDVaQESlRFsp0qXZMzbgx7VE/ND wx1TqOqxYUW5ImsLF9+tLIS8JhqcGpbAPYgOlVNfPbOXt1sA/nXwLjGY33ZppsnZERDC pCAGXA2VqKIzUI2v4IyUbuMRv7gPNo9pVmiJLnWM5q9an5ku64sl61T6uZgfx7NPqQnR 9Hd+ak7p7JYppWmjRvjpko78cDl1tPPQ0n0S3W58pjXJOGHBvswR0eNxsx2FeZPayavL EOsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=c21oKw15; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a6-20020a1709063a4600b007ae1874c142si1318985ejf.446.2022.11.03.10.29.04; Thu, 03 Nov 2022 10:29:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=c21oKw15; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231866AbiKCRLK (ORCPT + 97 others); Thu, 3 Nov 2022 13:11:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37540 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231601AbiKCRKg (ORCPT ); Thu, 3 Nov 2022 13:10:36 -0400 Received: from mail-qt1-x834.google.com (mail-qt1-x834.google.com [IPv6:2607:f8b0:4864:20::834]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DDAF11001 for ; Thu, 3 Nov 2022 10:09:28 -0700 (PDT) Received: by mail-qt1-x834.google.com with SMTP id x15so1621040qtv.9 for ; Thu, 03 Nov 2022 10:09:28 -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=JxCfvbb+eoelACSav5gOVJGA8b7JZzX3u9t6lpOqhGc=; b=c21oKw15OEDs7jPQQCx5/Q6jAakEjh4QCyHrqDrHmt1tZB5JiHbbDJmM+26GNCOUuA n2GMHrJ6v80we2vb5tM+7RBrSn/OgbLvIvKDSypwoGrv+vFeYz+qEx5tgHNFD4SDuMUn DyCZcKZmr8k62mDFGein3IhVz7jo4hs0ekZoI= 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=JxCfvbb+eoelACSav5gOVJGA8b7JZzX3u9t6lpOqhGc=; b=xs99gJIzTTVzl+h+lVLIMUrO24Lpg4eIUt4lRAZCC0QOiHDpvbe485nPRp+PL4HI05 2kg5+Zl3vUlIRmDeYi5vT+zEQ3aXbISVOpYon1UhQzXLbqRQYxGSHR7zzeSpQUluYp4I asnoUQIu4tTuY5Zb5J2rhggjfCuRl6g2Ey/rHUP47QbbUoJrr7WhiiibfXWfjnQKabdF W21ipoBUh/zSPhetJGaozAKFUeYeyr0fuLbQiT3WcDgGNkG/dDM5/d67FLblMVYQyhu/ +HEcmqjZ1XgmY1xACxfdGjPW9kwnlW/Q6N4p04vCzGSXgFmpdvX6MQeRrsfWa8W5F9pH zl2A== X-Gm-Message-State: ACrzQf0+h35qP44e1EHt9pGsw4rTxx0r3fVo3aePFNy9ZI8B9t177Ccq FKBrin3V4SBtT9mG4tr/jpYdUS25RqTasA== X-Received: by 2002:ac8:4b46:0:b0:3a5:1d94:751f with SMTP id e6-20020ac84b46000000b003a51d94751fmr21338157qts.102.1667495368053; Thu, 03 Nov 2022 10:09:28 -0700 (PDT) Received: from mail-yb1-f176.google.com (mail-yb1-f176.google.com. [209.85.219.176]) by smtp.gmail.com with ESMTPSA id az18-20020a05620a171200b006bb87c4833asm1050203qkb.109.2022.11.03.10.09.27 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 03 Nov 2022 10:09:27 -0700 (PDT) Received: by mail-yb1-f176.google.com with SMTP id 187so3031327ybe.1 for ; Thu, 03 Nov 2022 10:09:27 -0700 (PDT) X-Received: by 2002:a25:5389:0:b0:6bc:f12c:5d36 with SMTP id h131-20020a255389000000b006bcf12c5d36mr29702771ybb.184.1667495367212; Thu, 03 Nov 2022 10:09:27 -0700 (PDT) MIME-Version: 1.0 References: <47678198-C502-47E1-B7C8-8A12352CDA95@gmail.com> <140B437E-B994-45B7-8DAC-E9B66885BEEF@gmail.com> <4f6d8fb5-6be5-a7a8-de8e-644da66b5a3d@redhat.com> In-Reply-To: From: Linus Torvalds Date: Thu, 3 Nov 2022 10:09:11 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: mm: delay rmap removal until after TLB flush To: David Hildenbrand 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 Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Linus