Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp256257pxk; Thu, 1 Oct 2020 01:17:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxbcmvldqlt9sRtgXsVoEjAMX6ppbLcVKNeoFaL1KqsY3mdDAVO2+JbvGeusPjuYpmTj5Vm X-Received: by 2002:a05:6402:17b1:: with SMTP id j17mr6840230edy.253.1601540250253; Thu, 01 Oct 2020 01:17:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601540250; cv=none; d=google.com; s=arc-20160816; b=j97PngkznFzBRPapuTi53B30ofUGG50lkhF4rfMJ280r4NhNuC7bxySB38JLHJPteG edgfoQgmG6gxmeh74l2wwLWJRd6MhNQUv4OZZ4xo0SmkGbPe/jd+d7bBAd3xYHH8bM9+ cXaaLvCNudJBIdpfll6zcxoBBYMSmOWI1o1OAwFhehlQphm9BnyaBDTO15F3vA7S4m6o 6jAwielTgDSyki6QvkTgTtYyHkQt4iriPVTAPQJQylv2gsoeHYunLXnyFv+zqxWYBkIl 6yxmmW8mNFMXs/uso7M1q5rmRM9DEK/BK6ftFpeRKYOk3vZGgghkRoXZS4fFiXTa2qvZ RB4w== 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=KHP7yP8YvXTrdT4bCtfnJMoZCkKlbyAmgqN0FJrajaQ=; b=F3xedqJ/44K4zMIiCIoFgkWMbTReu05IaXI9RHeCLlqn8qf2PY6G+sioYV6HWQA7NE 84kwGATgMvICG4tjYvsWe5+VWu5jn1upL9MYF9J1FPXey8RG2XXEnN3Kz/qsAcEXHGhJ k/FZLcZPYj6f1xRZdKbYKldXl2ZedtD74njuAca41PmojnELB1TMz4MZvG7M//x/4++i zXhUED/NIAE0gEyM9z/pqbij5PtAQCmbLYs5ZKIlYifd9p32nKVq8pqS3f1OdugwhHFF imUu5spiHOynMSzHxOMbCrkA6T6NUnmzHz6pfYnMW6fwxQUy26hgGWb3lOvsgLSagrmg KNRA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=k835WoUy; 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 o18si352316ejm.80.2020.10.01.01.17.06; Thu, 01 Oct 2020 01:17:30 -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=k835WoUy; 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 S1731564AbgJAIOs (ORCPT + 99 others); Thu, 1 Oct 2020 04:14:48 -0400 Received: from mail.kernel.org ([198.145.29.99]:37804 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725894AbgJAIOs (ORCPT ); Thu, 1 Oct 2020 04:14:48 -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 4E72520BED; Thu, 1 Oct 2020 08:14:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601540087; bh=OQ5Rl7mvGEVxEAedAezsC2iYk6ORsvLvfeXsvmSGzK4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=k835WoUyIOxQs1vszUiMSjhhSn11jUXQ4TGNaslDPJ9EKG6CIPIx1unOuP857BqXd F1ArPeyz1k6Gs5CuzXCCFTlGWQZkxC6BH30SPuw/qvNv/yezU2G1NGKT7Dtwd3B07I 0dXT3c8NBDcUtoxf2jYtr1TPrqgIIGcfASC6m31I= Date: Thu, 1 Oct 2020 11:14:30 +0300 From: Mike Rapoport To: Matthew Wilcox Cc: Mike Rapoport , Peter Zijlstra , 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: <20201001081430.GA3537283@kernel.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> <20200930150928.GR20115@casper.infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200930150928.GR20115@casper.infradead.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 30, 2020 at 04:09:28PM +0100, Matthew Wilcox wrote: > 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. I meant that secremem allocates 2M in advance like THP and not that it similar because only page is accounted. Anyway, the intention was to account the entrire 2M chunk (512 pages), so I'll recheck the accounting and I'll fix it if I missed something. > And THP are reclaimable by vmscan, this is obviously not. True, this is more like mlock in that sense. -- Sincerely yours, Mike.