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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 732A2C433FE for ; Thu, 3 Nov 2022 17:37:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231549AbiKCRhT (ORCPT ); Thu, 3 Nov 2022 13:37:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50348 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230333AbiKCRhN (ORCPT ); Thu, 3 Nov 2022 13:37:13 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6BB3426C2 for ; Thu, 3 Nov 2022 10:36:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1667496974; 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=SH/G1phmFNnPBezQWLEXBC8Du32QWja8MjyTbMagOQKpkXZpf8lQkei0RTI3ubrJUcJM25 NCOYowp5lpoDNX8dihUbJcbnNkJ6zvM9j1eAXi6caPX3asSDRRpqBJ55x+BlwoZ8u4aKNu QCbbwhcPK1IPLVyA1X3SRb4jU5kehuQ= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-28-BLUf1PFaPjqy07aspd6EsA-1; Thu, 03 Nov 2022 13:36:13 -0400 X-MC-Unique: BLUf1PFaPjqy07aspd6EsA-1 Received: by mail-wm1-f71.google.com with SMTP id v23-20020a1cf717000000b003bff630f31aso769911wmh.5 for ; Thu, 03 Nov 2022 10:36:13 -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=G7+yrW6Pajz1Un9NmXBdK2nhrPS51YdlNErq6OpqWe0fUypdDDB+SG0Zf0S8lFBgaA Vxn6700fj/IwLJYHr0kHjNiSwMn9+/L+zjdXRmRT3CrktqNUofmTUmH9pel/rKYshnjy kMdqOXq46GQZ9J01DUGpsJ75oAPDTRShPWtZ1qVc4qGgfKk+jZiqN9jXjO/6eZMdAW9q H/U//OxRD/u2qDWyCDLBA3KbYTZm+yVwlRaNB3jg9mp+E8+OzPzlYZepIoJVm7u73OVq oJpTKNoZOzV2f39g1i/q9wrRBI0+1iTLo16dZ0RYSUAdvITXyW+h3TcJAeMBluiV34WO F/cA== X-Gm-Message-State: ACrzQf3TnTmxxyXLVW67l6I8Q27EHI1hWfpx0DwSdC6aORoEK4Xuazpr DY++HhK3aM9s+dosyVrSb/vduG7it3qxsBdlcQdulc/lE04soUrtlTXsE8ORpiGwGgsMxQSUTAQ fCw/z9012tEZbYByXlpCqZT3y X-Received: by 2002:a5d:4c43:0:b0:236:547f:bd3c with SMTP id n3-20020a5d4c43000000b00236547fbd3cmr20124907wrt.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 Content-Language: en-US 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: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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