Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp27808729rwd; Tue, 4 Jul 2023 08:08:36 -0700 (PDT) X-Google-Smtp-Source: APBJJlFtJL7lL96Bzh0W3Xxbxg3uFU3/jEwnPjog+nsfvWjK34zaw2Y4Jzur8Ztup5yBNAfqEJHx X-Received: by 2002:a1f:e484:0:b0:471:b18a:f9e5 with SMTP id b126-20020a1fe484000000b00471b18af9e5mr4277983vkh.4.1688483316570; Tue, 04 Jul 2023 08:08:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688483316; cv=none; d=google.com; s=arc-20160816; b=EVOR0L+1vrNvRlvcLc+uIiI+sDPmg5PP/ri7AQxSloo6QC3+t9OkofdeDVjGZdqpmU kzMZnEltoVdP1vTj/c10d6WxYoWuZozFtuxBVXvlpq6nUUDIlaCqJjWOBz+e5BbkiARY 4HjSnLJXcvwxTFNzX4i9RpvxY1rdk+iyObvlhQZBzlq6qGrqBLPi8gSUORfROwnc5BBX txSp5RSFBr3J/U7n8tJscuw99hvy06ZLWcSEHYA5yfROaXxR/KxmXYA4Wf0VNtcmYC4I egaveAhbmzSUddL5scpHyQxmy04HdwKB1umWj3YCCrhloiqWrDm4pLwCqMPrkQPDP5bh RTQA== 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=w3/eVaz1Sv3ukoIgcwC3gk343WJOF5YNTAEGH5+JlNE=; fh=bUsHy8XnQdFYxHFkG8irK+LUGy97GCYkWDqURksthdc=; b=QMDk2IJ9SYM2FcWjM1o7oxy5MR4V9HDMXisj8neNvdYiSn54qBp9dmY0IbjNTr0/2v jnON9O89NFyPX5RPEdZ+hWCuFaVhnB8BwxwiX+6otG8YmSKPlQoGz22PMe5nyZLToyAO D0L5QAFW2R9lZ/KWqgBarU7fGXygK6/AOqUD43cQoluTNJrAA4DADyiu651r+nR+6ud2 2uTzE07TxdwLINRmFHpxfPZQGzr9jDfCJJ1YDVEwZg5HZuu59w+k0Jez2AfiuzfTzUk0 YXmO/0mr4H2tMC6EDg34wWKgWtchcLk5JX64ivndmnEgE6opekQcbz9YOJ9OYuocqPnB sUGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=bMFyR4O3; 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=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w8-20020a63f508000000b0054fbd904b6dsi21873359pgh.500.2023.07.04.08.08.21; Tue, 04 Jul 2023 08:08:36 -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=@intel.com header.s=Intel header.b=bMFyR4O3; 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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231409AbjGDOhx (ORCPT + 99 others); Tue, 4 Jul 2023 10:37:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52780 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230200AbjGDOhw (ORCPT ); Tue, 4 Jul 2023 10:37:52 -0400 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 26F98E47; Tue, 4 Jul 2023 07:37:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1688481471; x=1720017471; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=3uPK0lQLnODbW5urZpqsXqNoSRHmvwzicJIhGoLTkFM=; b=bMFyR4O3Z5LBVuHSyrXZ+TJeLTUe79bo2t8i+ccei59ckkZoDMNo9nlh ffmcMDQEDKZlFp1L5B693nZA1Ya1EZD/RStfuf7+1NHA1h3ypjjn1zKu9 Fw2YuPhFuBUKxVdA2mZFRSeK8A9AM4cAS07K+IUirGCj2n78mb/2Ym5L1 CpORi+LTssTHoYyWQs3AoItP7LyIfLcC5KjloYgvbWmjy43ojusqoAJ18 +xBb9BVDEgjVYKuVA+yV+fQEWWokTPixaO8c+RyD9y1KtvTEwsUhpzmsW gePdoSz8bPlkWFnTMrbXmZQyfucn9fQtu/bydy24nFq7E96yZ1Rw9DqM7 w==; X-IronPort-AV: E=McAfee;i="6600,9927,10760"; a="343469398" X-IronPort-AV: E=Sophos;i="6.01,180,1684825200"; d="scan'208";a="343469398" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Jul 2023 07:37:50 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10760"; a="718940604" X-IronPort-AV: E=Sophos;i="6.01,180,1684825200"; d="scan'208";a="718940604" Received: from posikoya-mobl2.ger.corp.intel.com (HELO box.shutemov.name) ([10.252.49.196]) by orsmga002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Jul 2023 07:37:41 -0700 Received: by box.shutemov.name (Postfix, from userid 1000) id 27C2A10A08E; Tue, 4 Jul 2023 17:37:40 +0300 (+03) Date: Tue, 4 Jul 2023 17:37:40 +0300 From: "Kirill A. Shutemov" To: Mel Gorman Cc: Borislav Petkov , Andy Lutomirski , Dave Hansen , Sean Christopherson , Andrew Morton , Joerg Roedel , Ard Biesheuvel , Andi Kleen , Kuppuswamy Sathyanarayanan , David Rientjes , Vlastimil Babka , Tom Lendacky , Thomas Gleixner , Peter Zijlstra , Paolo Bonzini , Ingo Molnar , Dario Faggioli , Mike Rapoport , David Hildenbrand , marcelo.cerri@canonical.com, tim.gardner@canonical.com, khalid.elmously@canonical.com, philip.cox@canonical.com, aarcange@redhat.com, peterx@redhat.com, x86@kernel.org, linux-mm@kvack.org, linux-coco@lists.linux.dev, linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCHv14 5/9] efi: Add unaccepted memory support Message-ID: <20230704143740.bgimyg3bqsgxbm47@box.shutemov.name> References: <20230606142637.5171-1-kirill.shutemov@linux.intel.com> <20230606142637.5171-6-kirill.shutemov@linux.intel.com> <20230703132518.3ukqyolnes47i5r3@techsingularity.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230703132518.3ukqyolnes47i5r3@techsingularity.net> X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 Mon, Jul 03, 2023 at 02:25:18PM +0100, Mel Gorman wrote: > On Tue, Jun 06, 2023 at 05:26:33PM +0300, Kirill A. Shutemov wrote: > > efi_config_parse_tables() reserves memory that holds unaccepted memory > > configuration table so it won't be reused by page allocator. > > > > Core-mm requires few helpers to support unaccepted memory: > > > > - accept_memory() checks the range of addresses against the bitmap and > > accept memory if needed. > > > > - range_contains_unaccepted_memory() checks if anything within the > > range requires acceptance. > > > > Architectural code has to provide efi_get_unaccepted_table() that > > returns pointer to the unaccepted memory configuration table. > > > > arch_accept_memory() handles arch-specific part of memory acceptance. > > > > Signed-off-by: Kirill A. Shutemov > > Reviewed-by: Ard Biesheuvel > > Reviewed-by: Tom Lendacky > > By and large, this looks ok from the page allocator perspective as the > checks for unaccepted are mostly after watermark checks. However, if you > look in the initial fast path, you'll see this > > /* > * Forbid the first pass from falling back to types that fragment > * memory until all local zones are considered. > */ > alloc_flags |= alloc_flags_nofragment(ac.preferred_zoneref->zone, gfp); > > While checking watermarks should be fine from a functional perspective and > the fast paths are unaffected, there is a risk of premature fragmentation > until all memory has been accepted. Meeting watermarks does not necessarily > mean that fragmentation is avoided as pageblocks can get mixed while still > meeting watermarks. Could you elaborate on this scenario? Current code checks the watermark, if it is met, try rmqueue(). If rmqueue() fails anyway, try to accept more pages and retry the zone if it is successful. I'm not sure how we can get to the 'if (no_fallback) {' case with any unaccepted memory in the allowed zones. I see that there's preferred_zoneref and spread_dirty_pages cases, but unaccepted memory seems change nothing for them. Hm? -- Kiryl Shutsemau / Kirill A. Shutemov