Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp555492ybk; Sat, 9 May 2020 10:54:00 -0700 (PDT) X-Google-Smtp-Source: APiQypIJCDzl/JIu4WEvF9VVDuHCtcg54LCudJBVABbBcSRaGc9k71bY92oU6gw2bxYLJxbjMFEK X-Received: by 2002:a17:906:8611:: with SMTP id o17mr6886046ejx.221.1589046840353; Sat, 09 May 2020 10:54:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589046840; cv=none; d=google.com; s=arc-20160816; b=jKVRBcOPQJaZyJ6jCcu+2RmYwRPt+Pi9qsbGITgiPapbEZN9oWrOcW8wt69Z3t/ILO bOJ3N0xfBLy7/3ff+YRJ/b17kUHvt3nsHidiWjFUEm2E614k1XFYytzjRo9yUfn5HIqN 9mHEBg5BDLqR1dCB336pXXyrkuvXPxnHXtUPylos7wk/n3cr3EH9nmn65P3GQgCrUK/E TuJKXjIZnXoVv3pfMmvrG/mISaDSXMN2kwdNQKlcb09VNXs08HxOhOkSYpGO79Eedevl ILSd0VqqBzo+0ihPBd02cgFI8cye7Qk8dqMEpvFPiBgQ1gRkIdbi5b1PhaE9mC7cX+8w NEOg== 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; bh=RKNNh+uiXjv78RIKZeUWIjJ+Rfi6jbNKe5cUvVeeICE=; b=uX/DAEMnNNiSlTmEsmJiIdjYLVAVghzjOG1+eMA7bt5xz6HSGw1Jlu3Ih4/S1j8A9k g+9VcaWHLDS3e2uKY+tk8rst2irwrSYSkgqc8F860lbGuML09c82nBfczbxdV6A2ChCt B31KDSjPN5gY4oBx8T95FNYMVoCSKEQ45eUre83DtINRFPEMMN4h0xVE/in/KxCek0Do H4zFRgoURn5p5H3B5S3HWPApcliUavNmio5FDmp+qOoFl4F+qGC6JzCKQfcswSQ88Yzf q0PcF+/Ji0K4fXrWx0DKR0SaPXpp/EUR1W8M2xlQBsLlhVlBORhPDmm20Nznqz0o7Mtb i1tw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j4si3252237edq.8.2020.05.09.10.53.37; Sat, 09 May 2020 10:54:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728365AbgEIRwW (ORCPT + 99 others); Sat, 9 May 2020 13:52:22 -0400 Received: from mx2.suse.de ([195.135.220.15]:54418 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726214AbgEIRwW (ORCPT ); Sat, 9 May 2020 13:52:22 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 5F09FACFA; Sat, 9 May 2020 17:52:23 +0000 (UTC) Date: Sat, 9 May 2020 19:52:17 +0200 From: Joerg Roedel To: Andy Lutomirski Cc: Joerg Roedel , X86 ML , "H. Peter Anvin" , Dave Hansen , Peter Zijlstra , "Rafael J. Wysocki" , Arnd Bergmann , Andrew Morton , Steven Rostedt , Vlastimil Babka , Michal Hocko , LKML , Linux ACPI , linux-arch , Linux-MM Subject: Re: [RFC PATCH 0/7] mm: Get rid of vmalloc_sync_(un)mappings() Message-ID: <20200509175217.GV8135@suse.de> References: <20200508144043.13893-1-joro@8bytes.org> <20200508213609.GU8135@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, May 08, 2020 at 04:49:17PM -0700, Andy Lutomirski wrote: > On Fri, May 8, 2020 at 2:36 PM Joerg Roedel wrote: > > > > On Fri, May 08, 2020 at 02:33:19PM -0700, Andy Lutomirski wrote: > > > On Fri, May 8, 2020 at 7:40 AM Joerg Roedel wrote: > > > > > What's the maximum on other system types? It might make more sense to > > > take the memory hit and pre-populate all the tables at boot so we > > > never have to sync them. > > > > Need to look it up for 5-level paging, with 4-level paging its 64 pages > > to pre-populate the vmalloc area. > > > > But that would not solve the problem on x86-32, which needs to > > synchronize unmappings on the PMD level. > > What changes in this series with x86-32? This series sets ARCH_PAGE_TABLE_SYNC_MASK to PGTBL_PMD_MODIFIED, so that the synchronization happens every time PMD(s) in the vmalloc areas are changed. Before this series this synchronization only happened at arbitrary places calling vmalloc_sync_(un)mappings(). > We already do that synchronization, right? IOW, in the cases where > the vmalloc *fault* code does anything at all, we should have a small > bound for how much memory to preallocate and, if we preallocate it, > then there is nothing to sync and nothing to fault. And we have the > benefit that we never need to sync anything on 64-bit, which is kind > of nice. Don't really get you here, what is pre-allocated and why is there no need to sync and fault then? > Do we actually need PMD-level things for 32-bit? What if we just > outlawed huge pages in the vmalloc space on 32-bit non-PAE? Disallowing huge-pages would at least remove the need to sync unmappings, but we still need to sync new PMD entries. Remember that the size of the vmalloc area on 32 bit is dynamic and depends on the VM-split and the actual amount of RAM on the system. A machine wit 512MB of RAM and a 1G/3G split will have around 2.5G of VMALLOC address space. And if we want to avoid vmalloc-faults there, we need to pre-allocate all PTE pages for that area (and the amount of PTE pages needed increases when RAM decreases). On a machine with 512M of RAM we would need ca. 1270+ PTE pages, which is around 5M (or 1% of total system memory). Regards, Joerg