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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 09789C25B08 for ; Fri, 5 Aug 2022 14:41:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 671248E0002; Fri, 5 Aug 2022 10:41:42 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5F9AB8E0001; Fri, 5 Aug 2022 10:41:42 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4749D8E0002; Fri, 5 Aug 2022 10:41:42 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 333D38E0001 for ; Fri, 5 Aug 2022 10:41:42 -0400 (EDT) Received: from smtpin31.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id F16BEAC39B for ; Fri, 5 Aug 2022 14:41:41 +0000 (UTC) X-FDA: 79765802802.31.44621FA Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by imf02.hostedemail.com (Postfix) with ESMTP id 0D08C80140 for ; Fri, 5 Aug 2022 14:41:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1659710500; x=1691246500; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=jEZRMajvp62irH+o7cgsjZocWv3ZqbtMu1G37xj5vFw=; b=GPVaTBDeGzwE/mXWkQ8zz8MQB0fhvRwq63FD0s/6db7mUlBKtuNpqwin BI1rS96TgXhGAuDJTA7jHriTsPhjEIU2f3Xa9Juo6g/5Zk1Cv0ZSVYG5e JlvlSEdzcKGcv4BbkQrGQ/vRrh/i6JFRpZVyckVBjcbpL0HElFYki5qn7 1OqFFfJnHw1jovIRLMGmRSfbCWZeNRowO3dHaCJf1x01/x5ppKVxDB7bu 0s2tbhsU63n+ThEQr19NlREYS8pvEP+FBB1OSbuBg1VAUFAbu0jI8EWKi RtpUHpuU6TS4jFOjSs4SNv9dUsZsATjB5usuNdd6FO4+jp3NlyADRl80v w==; X-IronPort-AV: E=McAfee;i="6400,9594,10430"; a="273258922" X-IronPort-AV: E=Sophos;i="5.93,216,1654585200"; d="scan'208";a="273258922" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga106.jf.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 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1659710501; a=rsa-sha256; cv=none; b=ZA47bxJUhmSiBNv1z+AYX8qw4eSbGe5EadC4k3o65rpCy9dUglmq6f2yg7h32HJDDK78en O6ZXPFYWQpClbuPGfUIy+tXjLNeGAsnRJB9F1NVpFUWTEMiGAWvv6wH5nYE2b0SsnDhtBD bRz3MT0fvckJwXpNeHBmV02ggrJX7LQ= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=none ("invalid DKIM record") header.d=intel.com header.s=Intel header.b=GPVaTBDe; dmarc=pass (policy=none) header.from=intel.com; spf=pass (imf02.hostedemail.com: domain of dave.hansen@intel.com designates 134.134.136.126 as permitted sender) smtp.mailfrom=dave.hansen@intel.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1659710501; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=JCxUpZhFa0U7o8vJAO/6UddvObmx+WhIAvDOogKcPm0=; b=OJzYqhODRA3xfkNlAhPf8TZpj2thfsm3tEQh5kWmb1Sak4oPDwIWQ0L/i1Mhq+5mDHGCuS yPOTz736J57fLcZiFZyY3J8MOw/e1hL2Y1xidrhTLQfYA59dZ+H58qA//dTDs1wndDDgYT mUQ/FOUwG00qbmvH/KPtW33DeBCt/1E= Authentication-Results: imf02.hostedemail.com; dkim=none ("invalid DKIM record") header.d=intel.com header.s=Intel header.b=GPVaTBDe; dmarc=pass (policy=none) header.from=intel.com; spf=pass (imf02.hostedemail.com: domain of dave.hansen@intel.com designates 134.134.136.126 as permitted sender) smtp.mailfrom=dave.hansen@intel.com X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 0D08C80140 X-Rspam-User: X-Stat-Signature: eninri9knx6sz3xopqfqxjgibmz6ffqq X-HE-Tag: 1659710499-140928 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 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.