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 D9A2BC7618D for ; Thu, 6 Apr 2023 18:28:39 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 61C476B0071; Thu, 6 Apr 2023 14:28:39 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5CC1E6B0074; Thu, 6 Apr 2023 14:28:39 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4941D6B0075; Thu, 6 Apr 2023 14:28:39 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 356F26B0071 for ; Thu, 6 Apr 2023 14:28:39 -0400 (EDT) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id F2BA9C1334 for ; Thu, 6 Apr 2023 18:28:38 +0000 (UTC) X-FDA: 80651801916.11.58640CD Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) by imf30.hostedemail.com (Postfix) with ESMTP id 2A86D80021 for ; Thu, 6 Apr 2023 18:28:33 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=infradead.org header.s=desiato.20200630 header.b=HYwyP555; spf=none (imf30.hostedemail.com: domain of peterz@infradead.org has no SPF policy when checking 90.155.92.199) smtp.mailfrom=peterz@infradead.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1680805716; 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=krRR1rbNljM3A0v7Or9ollBea6RqbuAL/TrS9ntMbko=; b=jPZfejIbbl/xae97k6ppKXvNHhZJBKfut3AxYmZzGG+E/UzUHoi+fJwJmmA/5H1b//qQQO PT9N2/cb7U3z9B0q9N2G14XYQCgaJ+goSgdyTX7dwVW/TD8fRDDWeoacF0coi8z9B5nmsf Atb+WP15lRUfvVf8BhUIf98FSVNveX0= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=infradead.org header.s=desiato.20200630 header.b=HYwyP555; spf=none (imf30.hostedemail.com: domain of peterz@infradead.org has no SPF policy when checking 90.155.92.199) smtp.mailfrom=peterz@infradead.org; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1680805716; a=rsa-sha256; cv=none; b=M6TToiHjL5FLOyk94NDQ6aBpgPXRR1ov9iW5ILd4uXL4V0muD9OLxG0wB3Ip3Qa7P17H5k HoFTzXgImbW/1dgZaAHNrIB3EVs0AuyzPDOXTj0ziUehCxcflUvfQt7E8QhIlSSWkJo5Ft 8sQsD/B6XSGh7Q09oenaj+xYmFJ2G/Q= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=krRR1rbNljM3A0v7Or9ollBea6RqbuAL/TrS9ntMbko=; b=HYwyP5557eX2aBI0hUlezid1GH 5hoyG1Aj5dHjNeznaZOFr7Cy51rbii3Y5i3cE2woInFfeI8EAPtppz3o99BPe2GIduN6vXv6uyaw7 R9cuTob59q/BPrQnGdBywtK77Stl8OJJpBnvpSy/YFDL7vPiYkNIMiGQPDEidGAvoA4jROBnBdVah jOoSwHyGjI0QMaTrXlud204St1NXsF+ujX5WasSumcwLZCeKMORJsJy5xkcpHYXjSOgsSKV186/O/ cA0kt/u7rjhL3oPljvBtkfjk5sjNe9coia8oht3RGaO73x29c2Bi67dc2zk8arCu3QV+LNr4pLHNl VKwPG5qQ==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1pkUKx-00Ad17-2X; Thu, 06 Apr 2023 18:27:55 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id BDA6530008D; Thu, 6 Apr 2023 20:27:49 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id A5453212E36AA; Thu, 6 Apr 2023 20:27:49 +0200 (CEST) Date: Thu, 6 Apr 2023 20:27:49 +0200 From: Peter Zijlstra To: David Hildenbrand Cc: Marcelo Tosatti , Frederic Weisbecker , Yair Podemsky , linux@armlinux.org.uk, mpe@ellerman.id.au, npiggin@gmail.com, christophe.leroy@csgroup.eu, hca@linux.ibm.com, gor@linux.ibm.com, agordeev@linux.ibm.com, borntraeger@linux.ibm.com, svens@linux.ibm.com, davem@davemloft.net, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, will@kernel.org, aneesh.kumar@linux.ibm.com, akpm@linux-foundation.org, arnd@arndb.de, keescook@chromium.org, paulmck@kernel.org, jpoimboe@kernel.org, samitolvanen@google.com, ardb@kernel.org, juerg.haefliger@canonical.com, rmk+kernel@armlinux.org.uk, geert+renesas@glider.be, tony@atomide.com, linus.walleij@linaro.org, sebastian.reichel@collabora.com, nick.hawkins@hpe.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, sparclinux@vger.kernel.org, linux-arch@vger.kernel.org, linux-mm@kvack.org, vschneid@redhat.com, dhildenb@redhat.com, alougovs@redhat.com, jannh@google.com, Yang Shi Subject: Re: [PATCH 3/3] mm/mmu_gather: send tlb_remove_table_smp_sync IPI only to CPUs in kernel mode Message-ID: <20230406182749.GA405948@hirez.programming.kicks-ass.net> References: <20230404134224.137038-4-ypodemsk@redhat.com> <20230405195226.GB365912@hirez.programming.kicks-ass.net> <20230406132928.GM386572@hirez.programming.kicks-ass.net> <20230406140423.GA386634@hirez.programming.kicks-ass.net> <20230406150213.GQ386572@hirez.programming.kicks-ass.net> <248392c0-52d1-d09d-75ec-9e930435c053@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <248392c0-52d1-d09d-75ec-9e930435c053@redhat.com> X-Stat-Signature: 4as5jmc7kzkj19ycgcps3royaz6u4ymz X-Rspam-User: X-Rspamd-Queue-Id: 2A86D80021 X-Rspamd-Server: rspam06 X-HE-Tag: 1680805713-924703 X-HE-Meta: U2FsdGVkX1+sIca1AL7QUxDxG57XoW6OLJF3WXRM7JQR7KDaFKgtdLNfnIkARSJ0El5xePvB4eZ/GLIMHL6GRc6VmWI6rsiWQBcJ76WMwngEBkAROgfu4A5S5zHG/i1VXKvf341GK6eJRXP9hlPWumwsHPx47jyP3AFjco7ZchGi3EnlqO7W/CR/uAmvZQk0CrwNyINUMScJk9tOFXeMbOrX4BpFFwFjbckpOLR5maLSnPBFwLbVj6uLGswToyUl1t+PtuedmFNlhulJ7gNwzvlEvxkeVAXGAwNhnXIliJ6wo3DZrve9ab+/uuTWEI1PDQM1f2jxoghLrFEvUJDEjuyo69vL0DhpAqTlFpRNNW9ARo1ZSsEgvVZ6e1yZhVJEUvsp4JD74h6I1RNKaP8pOuFi50YhuC7VpuBCi5N0b/GGnHEM8Ra36kNAZKq5lxe5ZLZbLd4HijyJ55aKrVweY2YKI0up4ZyCjpqXgYuJ+JaHaAX9YAZRByyCxTJHoTg0frJyagc7eXH1/JNDS2tJD4X6GUepKSjGSKwIydqbAH7u/hM6HizRGX6O8qJJbpbmQM4M/vVAY95P26ehFapnVaJHrXM3wCMef3/Q8HPIneGoLwZI2qgnrha8LNunYqKQiFZz1Yw7nidzcanKmXj2RBCfDAcQvJdN6OOum9MGFvPGwqvBrS0U8yRH0RxmLa3ZhXEnrLJKGEKCtn65HQUMtGnEnp/gXGSxNzp6qeRT0+i5uAd7CPZLQ8UD0RSkh9VhHubY2F46qWsiZTwRsuV71JLCsMAQX4zocVQdcsVAF3lm8BAxiBr6v7bffuBMMlTeuzJ+TZdMA2qBFQ9cG/D6ApvndWCPrbthENgKnahMEclq1MVhI2C+u78p2oTwnw7gHm1z9laMZDIz5frkUiDf73rH7Zrz6+CPvoochp4kNQl9hoLKp+vWI4KbqZ2ktcPUgdWBs2uW/cKxlgWIvT5 tyd1xwCo Xlrq+MuF7eYbDOkQLSXW9kjYxXvW57SvVzVS2uARzIsebhpBGlAQ72SpJ8UH44fPuNyuJx3V7Xjc44+N6a84b57fJwT98z8YhgvaRatxHt/QfklcJSun9ES68SpJSBxiNd2BpwpB6gSvHRUv94NfIs0rgExmfSDXY3jgmWTGyvyL8VZK0TxnE7TYKircQ+v3agvwlXnDrHkpJ6PC/58JjNMBo7igwVZdkWsHNa1osqxR9Xilm6scRfwMLV8m3bB4LRWYkCWCbVh1od8zaaRrLojjLWwrTKOU/A3wHBf5Z4jZvbRdJ13nPTYUOMIdHJdHe01hXmRldXp4eBL3YSLc08TJtuG6wss8g9lSPx3HNFkwVMaxgKin+ycb1zFeJiNilbinTK7P8SM0SrkQPninCelXTpmN7PTCPj83g 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, Apr 06, 2023 at 05:51:52PM +0200, David Hildenbrand wrote: > On 06.04.23 17:02, Peter Zijlstra wrote: > > DavidH, what do you thikn about reviving Jann's patches here: > > > > https://bugs.chromium.org/p/project-zero/issues/detail?id=2365#c1 > > > > Those are far more invasive, but afaict they seem to do the right thing. > > > > I recall seeing those while discussed on security@kernel.org. What we > currently have was (IMHO for good reasons) deemed better to fix the issue, > especially when caring about backports and getting it right. Yes, and I think that was the right call. However, we can now revisit without having the pressure of a known defect and backport considerations. > The alternative that was discussed in that context IIRC was to simply > allocate a fresh page table, place the fresh page table into the list > instead, and simply free the old page table (then using common machinery). > > TBH, I'd wish (and recently raised) that we could just stop wasting memory > on page tables for THPs that are maybe never going to get PTE-mapped ... and > eventually just allocate on demand (with some caching?) and handle the > places where we're OOM and cannot PTE-map a THP in some descend way. > > ... instead of trying to figure out how to deal with these page tables we > cannot free but have to special-case simply because of GUP-fast. Not keeping them around sounds good to me, but I'm not *that* familiar with the THP code, most of that happened after I stopped tracking mm. So I'm not sure how feasible is it. But it does look entirely feasible to rework this page-table freeing along the lines Jann did.