Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp911070pxk; Fri, 25 Sep 2020 00:43:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy6LcajwSo4yZTvfCu7Wi3h868dJppFel93xfk+ua9MZHH55UNjt5sARIpCtZ357yclbJnA X-Received: by 2002:a05:6402:12d1:: with SMTP id k17mr2549173edx.323.1601019822074; Fri, 25 Sep 2020 00:43:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601019822; cv=none; d=google.com; s=arc-20160816; b=Eas5nVfP+yalQXnZLMEx1olyxYKZLBOm+AQJG3RV7HcT/RaeOhdT1O4pQJxHGIGVAz 2Zf9ddOebRfaHy+mVx0H0+h9Bjn7W4GNH1VXmO6KebsGG4ESg2eCVY1hCwDAfD4tuY15 OZAc6+zqJa3ReyYerAGOSTY9iOr+nPmq9cNRslxcISWA/nM835VJ1DHToRQkLnYysvqf tHtjJ5KqT/qFnUhh85LFkBw3LJj05SRPrVLxzYU5Ao2+swyqdTixqIDDDsK8p4hDe+mu TktomfoZM8ud+JpimtPw4OltskI4M4OL7he0LXSO4BMshrNYsgcS3TZyGeab8qGLAqSr /rAQ== 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=bEXaXvm5X4dVutGWrM3SYTUTdFiVFeL65RE2m3et63M=; b=oFGYE54Z6OUkqh9ZtOLmb69X+s0F6utGUiCrpp0rWaXd2cX2ahYHr1iKleYE1CRoaV h756wJruzaQLyq4BRGg6yESpoyBKUcfaxRq2WLM59RceVEXOdigcY9Jo3Pkrh3E8xrvF O04iKNhk4DyVmvNejEf+1X/KDQtVBX7GsbsN0Ipgct9XE0+CZ4LGmv6Gp5guSexeelsd 1CC+zFMc/Pxa2SMO2B4LBrnjQGbxSUouRh2xZfoRynw7SuEyC9Ct7FbAz7euLujZ+lOk 4qNxd45gt/W49UIx5RXheuEzJALGBAcY2i7ksSABQbAcsMCKQcsAP0E3RZa/20bsI/7K ROyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=merlin.20170209 header.b="AqV8/Bz0"; 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 gr23si1329201ejb.586.2020.09.25.00.43.18; Fri, 25 Sep 2020 00:43:42 -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=merlin.20170209 header.b="AqV8/Bz0"; 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 S1727472AbgIYHmD (ORCPT + 99 others); Fri, 25 Sep 2020 03:42:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47282 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727068AbgIYHl7 (ORCPT ); Fri, 25 Sep 2020 03:41:59 -0400 Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EC8F9C0613CE; Fri, 25 Sep 2020 00:41:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.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=bEXaXvm5X4dVutGWrM3SYTUTdFiVFeL65RE2m3et63M=; b=AqV8/Bz0cSC83Rc4UodMLetV/b H4Q0vcq/B2nX6a/1NGaWGgPy9xNSn1LvND0PyUTXFyVQQDT5oLPB4R8c7F6DSJkAKF4WKQIGFUdkp udYIlykogxqOjzXHo0dTH45OCQejslQx2zAkvYqsHkMfv2CW07yzU8ffQkFQ4Dd7EdxOV3+i8mUKa njAOTD+HbtsvbRxCq0XxlyIIOyW7fVHnik1sUzOd/1V41Nkhyz5aKi+ibCKKW9+5ewaVOy4aE5Mzo VDZRWpKNxXaa+GC031A6g07PAtFVpr0wW25aGZhIH14Nqkbd8hTliMwkhW/hIGQa2kxzNPWzmWLq7 ov9vR0rA==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1kLiMF-0003cu-I3; Fri, 25 Sep 2020 07:41:31 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 59EEE302753; Fri, 25 Sep 2020 09:41:25 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id B942B20104626; Fri, 25 Sep 2020 09:41:25 +0200 (CEST) Date: Fri, 25 Sep 2020 09:41:25 +0200 From: Peter Zijlstra To: Mike Rapoport Cc: 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" , Matthew Wilcox , Mark Rutland , Mike Rapoport , 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: <20200925074125.GQ2628@hirez.programming.kicks-ass.net> References: <20200924132904.1391-1-rppt@kernel.org> <20200924132904.1391-6-rppt@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200924132904.1391-6-rppt@kernel.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 24, 2020 at 04:29:03PM +0300, Mike Rapoport wrote: > From: Mike Rapoport > > Removing a PAGE_SIZE page from the direct map every time such page is > allocated for a secret memory mapping will cause severe fragmentation of > the direct map. This fragmentation can be reduced by using PMD-size pages > as a pool for small pages for secret memory mappings. > > Add a gen_pool per secretmem inode and lazily populate this pool with > PMD-size pages. What's the actual efficacy of this? Since the pmd is per inode, all I need is a lot of inodes and we're in business to destroy the directmap, no? Afaict there's no privs needed to use this, all a process needs is to stay below the mlock limit, so a 'fork-bomb' that maps a single secret page will utterly destroy the direct map. I really don't like this, at all. IIRC Kirill looked at merging the directmap. I think he ran into performance issues there, but we really need something like that before something like this lands.