Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp4645306pxk; Wed, 30 Sep 2020 08:11:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy80UHzPNwjlrwRvY0/l1WyCHPrG7rWrrX2zVzIs5EplLwEB9U49b/HE7odEMBLhqjw599E X-Received: by 2002:a17:906:c0c4:: with SMTP id bn4mr3232430ejb.27.1601478695845; Wed, 30 Sep 2020 08:11:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601478695; cv=none; d=google.com; s=arc-20160816; b=JE4/lrs3tCpCbfKHMIMPxp7eoEPlDShM1r+HJoxP29ZZUUWVcotpgaWMA7TjJE5Q8t bEnNjCh0wM1bmeDwbon5Z8hR4yfoxzevXD1qqCArQkLIPAVzsXLBr0GRBblqDnbq0faA yzzqeTNzKomQrxrcYc6qWOvem7pHM5zpIn166l2EssSgKo5IMEooOPfEfF2wmHqSQoSp nmeGyFrGbo12MHR7NyWFcf1WmxQjgnuhew6B84/EZ2JkCFpFU+hWEB/ii4rapszqcZn9 vr3Bap2WQr+tZ5R4yYsXIELK1U2U3Ww/P2PTGvj0sarHSRCKvO1OwAHyHmTNKTnzMdD1 3bFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=5MQ9wWjMl2wFlC5FFeBBoGdxqFKxERQlgHCfOe6SJqc=; b=SAwOgdGxiBS93MwMM+lhg3hC2qp5k1P44eHE71c6ESO+yGnuLS7q6beYORoYVx70Is uuKDB3TnBgETYwBixNMajup5Xv8RYD5llHZKw6XiFLe4fZIdIA/X18EKAawPfrfCv4wU JK3s8QBI5GkjEKumlv+L07b+yW4DIJBJ6JS+cni1zPKL9z7XGWrmt6oUrE2PTOEdNkRr cxT2ec8xb3kIe80IflqxtctZbd8DhexfcGfEdVwR2mv3vk6nDyOdnXk/dEB2aju0T4oT ehMYavKi55nWBFj2fL4bBbUAMczXiW7MMUJORojAEkatrWex43XsUkLSg8lOMpDuCDvc C1nw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=BuH49sEn; 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 gu21si1356310ejb.127.2020.09.30.08.11.11; Wed, 30 Sep 2020 08:11:35 -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; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=BuH49sEn; 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 S1730104AbgI3PKG (ORCPT + 99 others); Wed, 30 Sep 2020 11:10:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39228 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730601AbgI3PKF (ORCPT ); Wed, 30 Sep 2020 11:10:05 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ED1ABC0613D0; Wed, 30 Sep 2020 08:10:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.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; bh=5MQ9wWjMl2wFlC5FFeBBoGdxqFKxERQlgHCfOe6SJqc=; b=BuH49sEnpXdPdqBuzbVs2V633x nj0QNsnZGyV7Ur1XjcD+GgLOUPiioSSgYAd5LQANsJHnqdR8DPJWazR4b6fyMIXitNoG7i2qACEk+ x90zdteFRAk01MpO/bR6H/INrJI1XI2Z43TfeD0w4o67kW8JKU7F7v72SRgVVditUoo8hvSGVzDht IAsFpsrXy2rohggWiPlFlZ49/3gB8uDSMyALzcjv+0EyTng6cu9mrYkRLaKyDQJSYJSgaeqtXpg7T r4qwLvOvtVk6qnTcZdu5tJ+aiAkiq/I/XPzY9EzutGsKlZpzzVHG+lZEakQO08fZJbB9Z3UwWnHbB qlCH3W+Q==; Received: from willy by casper.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1kNdjU-0007EC-6u; Wed, 30 Sep 2020 15:09:28 +0000 Date: Wed, 30 Sep 2020 16:09:28 +0100 From: Matthew Wilcox To: Mike Rapoport Cc: Peter Zijlstra , Mike Rapoport , Andrew Morton , Alexander Viro , Andy Lutomirski , Arnd Bergmann , Borislav Petkov , Catalin Marinas , Christopher Lameter , Dan Williams , Dave Hansen , David Hildenbrand , Elena Reshetova , "H. Peter Anvin" , Idan Yaniv , Ingo Molnar , James Bottomley , "Kirill A. Shutemov" , Mark Rutland , Michael Kerrisk , Palmer Dabbelt , Paul Walmsley , Thomas Gleixner , Shuah Khan , Tycho Andersen , Will Deacon , linux-api@vger.kernel.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-nvdimm@lists.01.org, linux-riscv@lists.infradead.org, x86@kernel.org Subject: Re: [PATCH v6 5/6] mm: secretmem: use PMD-size pages to amortize direct map fragmentation Message-ID: <20200930150928.GR20115@casper.infradead.org> References: <20200924132904.1391-1-rppt@kernel.org> <20200924132904.1391-6-rppt@kernel.org> <20200925074125.GQ2628@hirez.programming.kicks-ass.net> <20200929130529.GE2142832@kernel.org> <20200929141216.GO2628@hirez.programming.kicks-ass.net> <20200929145813.GA3226834@linux.ibm.com> <20200929151552.GS2628@hirez.programming.kicks-ass.net> <20200930102745.GC3226834@linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200930102745.GC3226834@linux.ibm.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 30, 2020 at 01:27:45PM +0300, Mike Rapoport wrote: > On Tue, Sep 29, 2020 at 05:15:52PM +0200, Peter Zijlstra wrote: > > On Tue, Sep 29, 2020 at 05:58:13PM +0300, Mike Rapoport wrote: > > > On Tue, Sep 29, 2020 at 04:12:16PM +0200, Peter Zijlstra wrote: > > > > > > It will drop them down to 4k pages. Given enough inodes, and allocating > > > > only a single sekrit page per pmd, we'll shatter the directmap into 4k. > > > > > > Why? Secretmem allocates PMD-size page per inode and uses it as a pool > > > of 4K pages for that inode. This way it ensures that > > > __kernel_map_pages() is always called on PMD boundaries. > > > > Oh, you unmap the 2m page upfront? I read it like you did the unmap at > > the sekrit page alloc, not the pool alloc side of things. > > > > Then yes, but then you're wasting gobs of memory. Basically you can pin > > 2M per inode while only accounting a single page. > > Right, quite like THP :) Huh? THP accounts every page it allocates. If you allocate 2MB, it accounts 512 pages. And THP are reclaimable by vmscan, this is obviously not.