Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3779507pxk; Tue, 29 Sep 2020 06:11:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwuom7VIevsFeUfTssKvKVAjFFY6OzhYpbVKJ8ogRFAcJZRxiPppL7nzDupGThrHYX4L50R X-Received: by 2002:a5d:4811:: with SMTP id l17mr4417152wrq.252.1601385064433; Tue, 29 Sep 2020 06:11:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601385064; cv=none; d=google.com; s=arc-20160816; b=NJon3an2+JCzpC9BxqlwYjFiru3/rbEzmlscNcC4NqfdB5geUUV9M51GnypXI1IXyX vEt2NbMJakthjModePnwnANt2dDM3tEBA6xG23tLfhBA2siEOOhc5Rx4sBABv/4Q5DC7 auc9IYlMpM9rkFwOBgrkcjzkUfSRlOaXWv0/lBKF5PJk02gmih0Etx/25tEYHP0UM97M ryWUWzgfJ6zB83C3PptzBC2N2Fjrh/Q3Mp3beWMCWSYL07FsYDEH+YV6WCU0SoGqMcB6 HDt641V/UOrYBxqRocKzlo2Xqf9WTFFtocfN61huMQir4LuWaRcBjbYmXqSdmXKMK12X QE+g== 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=GT1uJUHhGgLg7pPI3NIP98ORh575ui3iv0fd1Chfm08=; b=iZjd9IlyntF1n28ww018bIxv/wnfTHswlo5RKhd7yU0SqaZeyt0d8tJ9bheKNNhl9f ebDAi+yOwdP8kvlkU0WwRgupzJNI81MGUzxxLg/lD1UEwfLZpiv98f1a5nJnDDcMjenR pCcg0TbZ0VFNgZwgvAAmTWA81aYEnoY0BQ4SJSHSoKrsUQacUoRt4+wnqf81ejiXWkpv TX0O5YQP0Z5nqzmSFbLSRNI71K4nALL2vd6tknLI41XvZTixXcDEr2hnqtCL6jpDfMp7 w3p9d6U3IJvDPkqPh2T1DNuYOGiQtrK8OR1dZD5Yd1Li/DknrlhINWkXZn0xNNPizrBs mqEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=GqCIqM7B; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z23si2715966edx.215.2020.09.29.06.10.41; Tue, 29 Sep 2020 06:11:04 -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=@kernel.org header.s=default header.b=GqCIqM7B; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728976AbgI2NHD (ORCPT + 99 others); Tue, 29 Sep 2020 09:07:03 -0400 Received: from mail.kernel.org ([198.145.29.99]:48840 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728423AbgI2NHC (ORCPT ); Tue, 29 Sep 2020 09:07:02 -0400 Received: from kernel.org (unknown [87.71.73.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 579B4207F7; Tue, 29 Sep 2020 13:06:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601384821; bh=7KLc+w8RZZNLjtjf6HYJ79RwMDeyJUnvfHtVGdo8qiw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=GqCIqM7BqT+6pPkJY9utQWj93QJ3bSPfFrqfJHOudSA2n7THcsgAIPdERjDgGYpbv 3YsHM8vksG2xzKmuaMDxtRxuppf8SFckyt7f4t7JRp6EXb5ekXTVyBUz49dbfKDnNc d4WEziQvM+yY9x8NI++tf8P6f980mVqec1FHevs4= Date: Tue, 29 Sep 2020 16:06:41 +0300 From: Mike Rapoport To: David Hildenbrand Cc: Peter Zijlstra , Andrew Morton , Alexander Viro , Andy Lutomirski , Arnd Bergmann , Borislav Petkov , Catalin Marinas , Christopher Lameter , Dan Williams , Dave Hansen , 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: <20200929130641.GG2142832@kernel.org> References: <20200924132904.1391-1-rppt@kernel.org> <20200924132904.1391-6-rppt@kernel.org> <20200925074125.GQ2628@hirez.programming.kicks-ass.net> <8435eff6-7fa9-d923-45e5-d8850e4c6d73@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8435eff6-7fa9-d923-45e5-d8850e4c6d73@redhat.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Sep 25, 2020 at 11:00:30AM +0200, David Hildenbrand wrote: > On 25.09.20 09:41, Peter Zijlstra wrote: > > 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. > > As I expressed earlier, I would prefer allowing allocation of secretmem > only from a previously defined CMA area. This would physically locally > limit the pain. The prevois version contained a patch that allowed reserving a memory pool for the secretmem at boot time to avpoid splitting pages from the direct map > But my suggestion was not well received :) The disagreemet was only whether to use CMA or simple boot time reservation :-P > -- > Thanks, > > David / dhildenb > -- Sincerely yours, Mike.