Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2735919rwd; Fri, 19 May 2023 09:29:27 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ45d4FSZrpRervh8SZMW9cUULnsDjRAzyHB9bQnIjMPyOIzl2unaY1OBhTLg5Sma/Ddq++r X-Received: by 2002:a17:903:32c7:b0:1ae:513a:9439 with SMTP id i7-20020a17090332c700b001ae513a9439mr3947342plr.23.1684513767073; Fri, 19 May 2023 09:29:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684513767; cv=none; d=google.com; s=arc-20160816; b=eU561ZaZgLfLA4a06XfK7gQMFQQg7VXiY5SsD+OYmeEp+asJFySW+HMX+JaxLk5Kir p2NRzaCu2QjVwdNIjyOw9S6uaIstmX6ZDWhuWFI3A6g8O8Fyin/UJLgHti7NIeH3lEC7 5Po0EXZjqV7mPcHv6QkaaN7+BLsLykv8/wMA6xPzIBRFp4uMf5JbuApPHaAW42lNUAZ0 WLg1s4b6mE1YCEaXuYRl8WnI6e04t0bQH80HVOdjjuA89BW5rZlsbThfHhzOzSO+PTB9 +Vb/hS6t3GPQT2sWvG41eHRI5lk+kQB7HOhxdSaORPWhlLYC/QZwd5vo9zMh/OynD4Oo r/qg== 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=62p3VH7Mpjh/FmnhJEf0oTtwxPDYVuCCfh8ofE+FxKw=; b=L81rhEG7DlRPN4cdhgCf+i3dPWcuFR7FoMhZXCoR5IZ8UOF7J3sYN+mdm4rS0EGWQA 96N4QhDCYAquYVghsavVVl6oGWrnCam0K9Go/ORpRrP2RqXF4WliQSP2yDjb3PXzKYEd YhhvJbTlhnCnLxNPfcS4CqG6Xnp0uJtHAE7ZC2pLulcJLQqZOoFia3WJ7WM6jWwHy1nW XyyCYpjmCOR9fgHC/xCIHsXO7/WBJubRSw/a5hehVFxibq4EbccFZ1CPHPu85sNOCEbh b82f+F8RKYc50kdOtdLoMx2wHgF6GjsM/N1MQDQJaYj5T/fmzJHAx9twtj9xd9zQDeVD sGRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=VF1ZxWOs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i5-20020a17090a974500b00252b824d13esi2017105pjw.30.2023.05.19.09.29.11; Fri, 19 May 2023 09:29:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=VF1ZxWOs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230268AbjESQY5 (ORCPT + 99 others); Fri, 19 May 2023 12:24:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51518 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230446AbjESQYs (ORCPT ); Fri, 19 May 2023 12:24:48 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B4A7FC9 for ; Fri, 19 May 2023 09:24:47 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3DABF65933 for ; Fri, 19 May 2023 16:24:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1B59DC43443; Fri, 19 May 2023 16:24:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1684513486; bh=l7IqxgTGgOUrrRLp/9kEkeElM34tTO5S0maFth2gfks=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=VF1ZxWOsDhHWaJROcCgln8Hk8HRRpZ6O1WlOpqGsQF66QGWjGTWJ9Nd1/D9UsgRIe vKUedzeZUSBtnbtv3lm0tFU5AsUwrTT6+sVq61IuhcRzdGrl0ZsyJLGpScoTfCXJJh zA7FNLg7M8o/dj/uZgSB1tGhC6Ibmoo5jD3SOjfazOqofa5udrf3iNq+BLaB8tFuR5 1fGrvop1FmSUiLwjXbquoL0VTW/G7AoWZVFrJnu3Zq5pgz5PwMeWGe93i1U8iFpgZ9 h22nqG/+VnalqFvfeQB5Rnm7Cd5gkJFPIDCaoU/OoGnH536xVCiWOLDAlLA36vlOl6 giYN9E4mPIOoA== Date: Fri, 19 May 2023 19:24:32 +0300 From: Mike Rapoport To: Sean Christopherson Cc: Rick P Edgecombe , "linux-mm@kvack.org" , "linux-kernel@vger.kernel.org" , "peterz@infradead.org" , "tglx@linutronix.de" , "song@kernel.org" , "dave.hansen@linux.intel.com" , "vbabka@suse.cz" , "x86@kernel.org" , "akpm@linux-foundation.org" Subject: Re: [RFC PATCH 0/5] Prototype for direct map awareness in page allocator Message-ID: <20230519162432.GG4967@kernel.org> References: <20230308094106.227365-1-rppt@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, May 19, 2023 at 08:40:48AM -0700, Sean Christopherson wrote: > On Thu, Mar 09, 2023, Mike Rapoport wrote: > > On Thu, Mar 09, 2023 at 01:59:00AM +0000, Edgecombe, Rick P wrote: > > > On Wed, 2023-03-08 at 11:41 +0200, Mike Rapoport wrote: > > > > From: "Mike Rapoport (IBM)" > > > > > > > > Hi, > > > > > > > > This is a third attempt to make page allocator aware of the direct > > > > map > > > > layout and allow grouping of the pages that must be unmapped from > > > > the direct map. > > > > > > > > This a new implementation of __GFP_UNMAPPED, kinda a follow up for > > > > this set: > > > > > > > > https://lore.kernel.org/all/20220127085608.306306-1-rppt@kernel.org > > > > > > > > but instead of using a migrate type to cache the unmapped pages, the > > > > current implementation adds a dedicated cache to serve __GFP_UNMAPPED > > > > allocations. > > > > > > It seems a downside to having a page allocator outside of _the_ page > > > allocator is you don't get all of the features that are baked in there. > > > For example does secretmem care about numa? I guess in this > > > implementation there is just one big cache for all nodes. > > > > > > Probably most users would want __GFP_ZERO. Would secretmem care about > > > __GFP_ACCOUNT? > > > > The intention was that the pages in cache are always zeroed, so __GFP_ZERO > > is always implicitly there, at least should have been. > > Would it be possible to drop that assumption/requirement, i.e. allow allocation of > __GFP_UNMAPPED without __GFP_ZERO? At a glance, __GFP_UNMAPPED looks like it would > be a great fit for backing guest memory, in particular for confidential VMs. And > for some flavors of CoCo, i.e. TDX, the trusted intermediary is responsible for > zeroing/initializing guest memory as the untrusted host (kernel/KVM) doesn't have > access to the guest's encryption key. In other words, zeroing in the kernel would > be unnecessary work. Making and unmapped allocation without __GFP_ZERO shouldn't be a problem. However, using a gfp flag and hooking up into the free path in page allocator have issues and preferably should be avoided. Will something like unmapped_alloc() and unmapped_free() work for your usecase? -- Sincerely yours, Mike.