From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 14176C433B4 for ; Wed, 5 May 2021 13:10:14 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 56AC4613BF for ; Wed, 5 May 2021 13:10:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 56AC4613BF Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 983976B006C; Wed, 5 May 2021 09:10:12 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9338F6B006E; Wed, 5 May 2021 09:10:12 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7D3F26B0070; Wed, 5 May 2021 09:10:12 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0117.hostedemail.com [216.40.44.117]) by kanga.kvack.org (Postfix) with ESMTP id 612DC6B006C for ; Wed, 5 May 2021 09:10:12 -0400 (EDT) Received: from smtpin40.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id EC4A51801B5EA for ; Wed, 5 May 2021 13:10:11 +0000 (UTC) X-FDA: 78107210622.40.115E1F9 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf10.hostedemail.com (Postfix) with ESMTP id CB10940002C7 for ; Wed, 5 May 2021 13:09:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.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=RCnOPkMC/G1Vcdql+vcGlBPx7y6AVxksEchUg4RxzkQ=; b=HfZvW5qU94p4oR2x4wqzGUPz2C oUXMRaZvZIiKUS0yu7zzm9G8JgWZKmdwbOIuReAcoiBJNS2SeFYoosJWcnydI27HD4ZLYn9SYeL+W BXZkVVtX1MN8k7232jA7Vj7pPv3nuhhdRuDgOeHiiLjJL1JXEbaWaNfMo7MjFV2tnhF5jbwLGzGt2 wmR6p75zHIsBDQ6GkXyT+tVRkvbmuibjXvIdM08ySYeuUagX9MzvqKuyg3r5tV41aIUFmF2iBKqPj xYjLfvxZhXqEqjKGsPw88JEHUSK7oFKjoAGuz41FoVzkFAnbsvnonAkNYrS0LgisF2C8ubNhwx4pz s5bxp44g==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94 #2 (Red Hat Linux)) id 1leHHB-000LZH-U8; Wed, 05 May 2021 13:09:36 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id CAC99300103; Wed, 5 May 2021 15:09:12 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 5B8FB203E67C5; Wed, 5 May 2021 15:09:12 +0200 (CEST) Date: Wed, 5 May 2021 15:09:12 +0200 From: Peter Zijlstra To: Mike Rapoport Cc: Rick Edgecombe , dave.hansen@intel.com, luto@kernel.org, linux-mm@kvack.org, x86@kernel.org, akpm@linux-foundation.org, linux-hardening@vger.kernel.org, kernel-hardening@lists.openwall.com, ira.weiny@intel.com, dan.j.williams@intel.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH RFC 3/9] x86/mm/cpa: Add grouped page allocations Message-ID: References: <20210505003032.489164-1-rick.p.edgecombe@intel.com> <20210505003032.489164-4-rick.p.edgecombe@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: CB10940002C7 Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=HfZvW5qU; dmarc=none; spf=none (imf10.hostedemail.com: domain of peterz@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=peterz@infradead.org X-Rspamd-Server: rspam04 X-Stat-Signature: wuuj8fk9ua4dc39uxgk1aedpzowhrf5t Received-SPF: none (infradead.org>: No applicable sender policy available) receiver=imf10; identity=mailfrom; envelope-from=""; helo=casper.infradead.org; client-ip=90.155.50.34 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1620220197-587825 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Wed, May 05, 2021 at 03:08:27PM +0300, Mike Rapoport wrote: > On Tue, May 04, 2021 at 05:30:26PM -0700, Rick Edgecombe wrote: > > For x86, setting memory permissions on the direct map results in fracturing > > large pages. Direct map fracturing can be reduced by locating pages that > > will have their permissions set close together. > > > > Create a simple page cache that allocates pages from huge page size > > blocks. Don't guarantee that a page will come from a huge page grouping, > > instead fallback to non-grouped pages to fulfill the allocation if > > needed. Also, register a shrinker such that the system can ask for the > > pages back if needed. Since this is only needed when there is a direct > > map, compile it out on highmem systems. > > I only had time to skim through the patches, I like the idea of having a > simple cache that allocates larger pages with a fallback to basic page > size. > > I just think it should be more generic and closer to the page allocator. > I was thinking about adding a GFP flag that will tell that the allocated > pages should be removed from the direct map. Then alloc_pages() could use > such cache whenever this GFP flag is specified with a fallback for lower > order allocations. That doesn't provide enough information I think. Removing from direct map isn't the only consideration, you also want to group them by the target protection bits such that we don't get to use 4k pages quite so much.