Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp4455643pxk; Wed, 30 Sep 2020 03:31:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwp1DJcZv0XVlBrX2labXE9yLodimoq+Tuw/klFUxLia8z7I0eTmiLONjbo+51Aglw7+tMn X-Received: by 2002:aa7:d458:: with SMTP id q24mr1964136edr.23.1601461901546; Wed, 30 Sep 2020 03:31:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601461901; cv=none; d=google.com; s=arc-20160816; b=QhO4UZ8l0aeA92CHKW0uGIPu48PFPCASIdmWFu589EBGna53qa55NeOSkRRyIJQFhN 3r5qUS3MVMzLyYwGnmhxfknPBpZZMEvwCtOUxoxKtnuoqpieWKV0EMyBuDhEGVCC+VON RQ5mARSrMXy1O/vX5r38PtS/rlWW+PRqbJ0cIrGO77sU0VqMLJ8nCb9dJSAqNtoV1Nmy P0jTaRexNZUR/N/sBdbQX6ukwOxor+O5zD2+P2UDZdLV6dplDr/GB9sK3LjqIt/cHCGH tV3bublsSM8VKNQ6/3b8BClcir5387E3XCcN73YPBnFvx1reBnFNezB7w5NYXTtzQIVK Tx0w== 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=YLMZRYhLxXYowrAZOtKzuR/O6QgcBOt/bbAeTvAVLYk=; b=aBqbuza/ZYefA2B0dICtPHr6ipXjqRZa8aRG1DdT1OL+ILtFtaMiwiWxkA0zuWegli IThUZTNtkGHgoZkdDNZqfZzs9VrboB0kgF6zSImnw8NmTFxurIYuGKF33PN5FNNVe7I6 sfKPOmrNLZTkmtza1A6+8s/df+rnIerZozBuEBgce08qcD/a3aPbLVi2LEk8gKHjwYHv TjqbBiw+TDt5xUNx00lDppzZaM61C1twzDN3z8Bpj2vJMzL1i/l5hSesawxz5/Vd0Ijs bnLEL6ZEgV4ekl+CisrS17chpopEIyQYCOQLndgDURwOCi85RSk791ciKg4uAsYxcXii v8cA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=DMFFWxWQ; 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=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u18si196763ejg.28.2020.09.30.03.31.19; Wed, 30 Sep 2020 03:31:41 -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=@ibm.com header.s=pp1 header.b=DMFFWxWQ; 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=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729357AbgI3K2m (ORCPT + 99 others); Wed, 30 Sep 2020 06:28:42 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:7390 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728500AbgI3K2l (ORCPT ); Wed, 30 Sep 2020 06:28:41 -0400 Received: from pps.filterd (m0098413.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 08UACrbo033738; Wed, 30 Sep 2020 06:27:57 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=pp1; bh=YLMZRYhLxXYowrAZOtKzuR/O6QgcBOt/bbAeTvAVLYk=; b=DMFFWxWQQQ/dOUDvmOcVNiZFPAqDQ+snKuj9I6y9e7JHxF4bBih3sAFH5XZIn/4WPNpW gyMRwSGnThr/oC4YT6P+4JGsCQA/nOuSjX7YuhpWz46EXu65qVfgIz2hFfaGewFvSaoS L0gg9kNhzz5iwXCb22/7peTMmvDQaTyxwsYgmt7chFrzDHZMvHLEMmD5TvagNiMShquq vw8E4ePr5a9XSW1nrzo4fHkmXkMVeMNJU2a2YlPEySk58tXJVrLzC+um0RhsN8HafEyD LJfK1Zy1eWk6G7U5hrspZWnWHBA5T90SHU1OjQWl9PYBFWCWxXH2Ha9j9c3iVKR3pYxn fQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com with ESMTP id 33vr2hgdas-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 30 Sep 2020 06:27:57 -0400 Received: from m0098413.ppops.net (m0098413.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 08UADAG4034594; Wed, 30 Sep 2020 06:27:56 -0400 Received: from ppma06ams.nl.ibm.com (66.31.33a9.ip4.static.sl-reverse.com [169.51.49.102]) by mx0b-001b2d01.pphosted.com with ESMTP id 33vr2hgd9x-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 30 Sep 2020 06:27:56 -0400 Received: from pps.filterd (ppma06ams.nl.ibm.com [127.0.0.1]) by ppma06ams.nl.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 08UAMX6f004141; Wed, 30 Sep 2020 10:27:54 GMT Received: from b06avi18878370.portsmouth.uk.ibm.com (b06avi18878370.portsmouth.uk.ibm.com [9.149.26.194]) by ppma06ams.nl.ibm.com with ESMTP id 33v6mgruss-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 30 Sep 2020 10:27:54 +0000 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06avi18878370.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 08UARpio24969710 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 30 Sep 2020 10:27:51 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C1F85AE053; Wed, 30 Sep 2020 10:27:51 +0000 (GMT) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B2A9AAE045; Wed, 30 Sep 2020 10:27:47 +0000 (GMT) Received: from linux.ibm.com (unknown [9.145.79.47]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Wed, 30 Sep 2020 10:27:47 +0000 (GMT) Date: Wed, 30 Sep 2020 13:27:45 +0300 From: Mike Rapoport To: Peter Zijlstra Cc: 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" , Matthew Wilcox , 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: <20200930102745.GC3226834@linux.ibm.com> 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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200929151552.GS2628@hirez.programming.kicks-ass.net> X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235,18.0.687 definitions=2020-09-30_05:2020-09-29,2020-09-30 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 mlxlogscore=950 malwarescore=0 phishscore=0 mlxscore=0 clxscore=1015 bulkscore=0 adultscore=0 priorityscore=1501 lowpriorityscore=0 spamscore=0 suspectscore=1 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2009300075 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 :) I considered using a global pool of 2M pages for secretmem and handing 4K pages to each inode from that global pool. But I've decided to waste memory in favor of simplicity. The prevoius version of this set included additional patch that allowed reserving chunk of the physical memory for a global secretmem pool at boot time. We didn't reach an agreement with David H. about whether this pool should be allocated directly from memblock or from CMA and I've dropped the boot time reservation patch because it can always be added on top. -- Sincerely yours, Mike.