Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp1883677imm; Tue, 22 May 2018 10:51:48 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqTaew972gctN7QaeQg6wr+RWNsHks5EB/TzMIzOlVijK/ChTLQVqFcRZxiTRdPoVZ/tDVh X-Received: by 2002:a63:4207:: with SMTP id p7-v6mr19842851pga.163.1527011508579; Tue, 22 May 2018 10:51:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527011508; cv=none; d=google.com; s=arc-20160816; b=mgubr96dOD3iWGyHufUQaMwg2xg6h4GL/+1mvE2JMTi5z5fHdHjBb4G4w2hpf6lpvY OM9Sjd2rSegUQoG+0nfYilWjKuzCnvUODA6upkmKmOuR8sxlK3WwbeEt3VAd7dSIV9Qv pV/gI5FXUvAI9qmT6KnKkCkSr3CBTYW/3C4cobRrMOnGiOsGThWuvTLahQhqMeL+UZyF LZs/i6LfZgFdLE87pBWXP/r8iaGriDevL6appHvm1YV4aaEr997PMaH1MjzY3kjcFqyD 6Ty4xfegqE0MXcgHov0xWT+q4G1L2HzJFt5XTMNmH8eEA53aH20DvA5r/h6UT552FVBT D1Tw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=s7PkMkjuoZTLef+KQ6ZzBqD5u54rig/wbEDP71cNrKw=; b=wY5tAMKsZyMyDempeRx09Zk4u+E5FhYXMwmLZKWPhUxhPSaSu/m4BSLCECfDJ12rRm uFniVPQyOBbjfa4x7YVXkgQLiZ5qkvmJk9ksJgIc7cpRQNYnxHaYN0xsa2ycbq+bQ9I7 2wRjL0nCNb075TOovJxxt08wRf8BptEg8Lrb/lZrl20DQqubiiDfZIYs9O6+lXwDFjSH NqmgXcH1p66h6+/Rf4GqnOw2dlTyN15d3nnJEYMT/zEZ2/FQ8mGpHiHWV6cJtZcaU+jh IUmPo7+w0h9lL9HChgua7b4owFc64ckUlen9gFiNc3NroOSIWh/APztuq1JnYjrVgeW0 YYBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=iayeDDGQ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o189-v6si16572563pfo.20.2018.05.22.10.51.33; Tue, 22 May 2018 10:51:48 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=iayeDDGQ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751701AbeEVRvU (ORCPT + 99 others); Tue, 22 May 2018 13:51:20 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:59140 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751268AbeEVRvS (ORCPT ); Tue, 22 May 2018 13:51:18 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; 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:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=s7PkMkjuoZTLef+KQ6ZzBqD5u54rig/wbEDP71cNrKw=; b=iayeDDGQZPY/eWTsb2rKcF9ip FQBrUSdjSgEm60HYlsvsZpAWjkbreebhkXJ4ozAcT0h1c5UzhXmgkFSmBqBtvdhSLxDpgzgaStiTP FoBFN+qbqxv1DjvGjNTgwvqw4YIxm+rARygZfyIjL9bFlY3sOQc8as4tIexSyQQ9X4Em+1rJt78OE fpKntB2OrFzW7sOXg6X6kDQ+EOKDqmN7iMLpKA+Xk/6z8EbzBzYRtdL5WgCjlMmBkirggVaa2CS3m Rc8Bryg3YQxiuP77axXYf/Q3d5yLWOW8qMMjmr1nXrgzijxHyonQRJjZb3UUUFFYBP1h9TkHhkwrC NsxJqO61w==; Received: from willy by bombadil.infradead.org with local (Exim 4.90_1 #2 (Red Hat Linux)) id 1fLBRL-000120-5o; Tue, 22 May 2018 17:51:15 +0000 Date: Tue, 22 May 2018 10:51:14 -0700 From: Matthew Wilcox To: Dave Hansen Cc: Christopher Lameter , Boaz Harrosh , Jeff Moyer , Andrew Morton , "Kirill A. Shutemov" , linux-kernel , linux-fsdevel , "linux-mm@kvack.org" , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , x86@kernel.org, Peter Zijlstra , Rik van Riel , Jan Kara , Matthew Wilcox , Amit Golander Subject: Re: [PATCH] mm: Add new vma flag VM_LOCAL_CPU Message-ID: <20180522175114.GA1237@bombadil.infradead.org> References: <0efb5547-9250-6b6c-fe8e-cf4f44aaa5eb@netapp.com> <20180514191551.GA27939@bombadil.infradead.org> <7ec6fa37-8529-183d-d467-df3642bcbfd2@netapp.com> <20180515004137.GA5168@bombadil.infradead.org> <010001637399f796-3ffe3ed2-2fb1-4d43-84f0-6a65b6320d66-000000@email.amazonses.com> <5aea6aa0-88cc-be7a-7012-7845499ced2c@netapp.com> <50cbc27f-0014-0185-048d-25640f744b5b@linux.intel.com> <0100016388be5738-df8f9d12-7011-4e4e-ba5b-33973e5da794-000000@email.amazonses.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 22, 2018 at 10:03:54AM -0700, Dave Hansen wrote: > On 05/22/2018 09:46 AM, Christopher Lameter wrote: > > On Tue, 22 May 2018, Dave Hansen wrote: > > > >> On 05/22/2018 09:05 AM, Boaz Harrosh wrote: > >>> How can we implement "Private memory"? > >> Per-cpu page tables would do it. > > We already have that for percpu subsystem. See alloc_percpu() > > I actually mean a set of page tables which is only ever installed on a > single CPU. The CPU is architecturally allowed to go load any PTE in > the page tables into the TLB any time it feels like. The only way to > keep a PTE from getting into the TLB is not ensure that a CPU never has > any access to it, and the only way to do that is to make sure that no > set of page tables it ever loads into CR3 have that PTE. > > As Peter said, it's possible, but not pretty. But CR3 is a per-CPU register. So it'd be *possible* to allocate one PGD per CPU (per process). Have them be identical in all but one of the PUD entries. Then you've reserved 1/512 of your address space for per-CPU pages. Complicated, ugly, memory-consuming. But possible.