Received: by 2002:a05:6358:e9c4:b0:b2:91dc:71ab with SMTP id hc4csp1792057rwb; Fri, 5 Aug 2022 07:55:07 -0700 (PDT) X-Google-Smtp-Source: AA6agR52iG/gTELbvIY2e8J+G3INwSzOz2Ou2Cx+xJ7HpvrJBo4iBW06+8s1Us3fOWn1DmJ6x/2N X-Received: by 2002:a17:902:d2d1:b0:16e:eeac:29ab with SMTP id n17-20020a170902d2d100b0016eeeac29abmr7282631plc.125.1659711307037; Fri, 05 Aug 2022 07:55:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659711307; cv=none; d=google.com; s=arc-20160816; b=Q2EgvlDrJ8wYVHpc2eLKbqNuqEe9q8H1Ns1ArEFdet0wzCV4dbWeO2BOhsuq2C89mV kIu9ReGciNIbLc6sDncTp7tB7okjDF6St1twHtVzbLiwTsJAlST9pz7M66clbH8lZOui JSKx1t1la94a/uoUGjjLeugZ49uHzLvztVH2jfLyThxvJVNlURAwC+hAbkw0hm1KEt4p sEFj9pE1sI+yLcqdZPBHPo96TCDdE4xXwdpS7gBL3czATz/bDXnW0I2GSMttbW105YeH JU++yC4nmIxAcz3hRWERoRVhKtvhq/+VEirjG6S7hiJgeUCz2aAMof5zT43fVItMqbIg stUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=JCxUpZhFa0U7o8vJAO/6UddvObmx+WhIAvDOogKcPm0=; b=WN5wa90G+PhPsCPo8fV8kuLYpI/yjxWTlFckmAAZEKqZn6CQubFVpBE+SPchzFSgPX 3YhUpWDbwlCzqAceXOtSyLcgumbFESsQ4mefvXUNrc0zaxXM7UmS6Fs273lpQ7iO1zbL 4EqFQZdFmWCn5jz2evsX0+LcqNXo65T3vNsRlYic+P1l8CBuyjAin5apCpduiLERVb+C edzFcTRoG8Jzy5qm8S0OdysTexHQucpplYsZ+tPve9Jf1ShK7VystDnp/5VjLgGYyJhN QLPX0XttOiXE0FYK64rustBnIKfLIp4zH27lxv92lUH5uDmj8BZgMStHhzZrjVd94Plf g8mg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=CceQ7Xbd; 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 mt3-20020a17090b230300b001ed01b4f1c2si4114892pjb.24.2022.08.05.07.54.51; Fri, 05 Aug 2022 07:55:07 -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=CceQ7Xbd; 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 S240810AbiHEOll (ORCPT + 99 others); Fri, 5 Aug 2022 10:41:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34232 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230363AbiHEOlk (ORCPT ); Fri, 5 Aug 2022 10:41:40 -0400 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3627F6151; Fri, 5 Aug 2022 07:41:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1659710499; x=1691246499; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=jEZRMajvp62irH+o7cgsjZocWv3ZqbtMu1G37xj5vFw=; b=CceQ7Xbdwk4FWfHSrIVCYF6ff5Z1hYhHkCpzaNPgJEEI/piT+/ZMbl6P SqtEnwqF/XLS6DQ3RBnwRCJwIdGUugwGkU7n8xeF796z8LoAJjurEcThq 15rFBxPQZvf5maVLgh4FY1DbmBktpfJMvyZdBH+JiovTEl6HTpvD19kT0 2U/8m+ed3yw2aG3hfYISXCWZI3ExlgmdzXPF6wAquOgq+yyTuiqFIq75H +wBzSu3kPgnjyFGUJHTXxCOeXqBY5OYSBaTi1nbjXcL72xz9oAdXI9Glo kSbxurz8IagGvVhOtW7RZ67EkM7dur8WCebtt8tRrjHu8VNQredBnwr7w Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10430"; a="376508901" X-IronPort-AV: E=Sophos;i="5.93,216,1654585200"; d="scan'208";a="376508901" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Aug 2022 07:41:38 -0700 X-IronPort-AV: E=Sophos;i="5.93,216,1654585200"; d="scan'208";a="579518635" Received: from rderber-mobl1.amr.corp.intel.com (HELO [10.212.217.71]) ([10.212.217.71]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Aug 2022 07:41:37 -0700 Message-ID: Date: Fri, 5 Aug 2022 07:41:38 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: [PATCHv7 02/14] mm: Add support for unaccepted memory Content-Language: en-US To: Vlastimil Babka , David Hildenbrand , "Kirill A. Shutemov" , Borislav Petkov , Andy Lutomirski , Sean Christopherson , Andrew Morton , Joerg Roedel , Ard Biesheuvel Cc: Andi Kleen , Kuppuswamy Sathyanarayanan , David Rientjes , Tom Lendacky , Thomas Gleixner , Peter Zijlstra , Paolo Bonzini , Ingo Molnar , Dario Faggioli , Mike Rapoport , marcelo.cerri@canonical.com, tim.gardner@canonical.com, khalid.elmously@canonical.com, philip.cox@canonical.com, x86@kernel.org, linux-mm@kvack.org, linux-coco@lists.linux.dev, linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org, Mike Rapoport , Mel Gorman References: <20220614120231.48165-1-kirill.shutemov@linux.intel.com> <20220614120231.48165-3-kirill.shutemov@linux.intel.com> <8cf143e7-2b62-1a1e-de84-e3dcc6c027a4@suse.cz> From: Dave Hansen In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_NONE,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 8/5/22 06:38, Vlastimil Babka wrote: >> I'm sure we could optimize for the !unaccepted memory via static keys >> also in this version with some checks at the right places if we find >> this to hurt performance? > It would be great if we would at least somehow hit the necessary code only > when dealing with a >=pageblock size block. The bitmap approach and > accepting everything smaller uprofront actually seems rather compatible. Yet > in the current patch we e.g. check PageUnaccepted(buddy) on every buddy size > while merging. Needing to check PageUnaccepted() during the merge is fallout from moving the acceptance to post_alloc_hook(). I _think_ an earlier version of this did page acceptance under the zone lock, closer to where the page comes off the 2M/4M lists. But, page acceptance is horribly slow, so I asked Kirill to move it out from under the zone lock. Doing it in post_alloc_hook() (after the zone lock is dropped) makes a lot of sense since we do zeroing in there and zeroing is also nice and slow. But, post_alloc_hook() is long after the 2M page has been split and that means that we have to deal with potentially unaccepted pages during merges. I think there are three basic options: 1. This patch: Do acceptance after the zone lock is dropped and deal with mixed-acceptance merges 2. Do acceptance under the zone lock as pages come off the 2M/4M lists, but before the page is split. 3. Pull the page off the 2M/4M lists, drop the zone lock, accept it, then put it back. I'm not sure any of those other options are better.