Received: by 2002:a05:6358:e9c4:b0:b2:91dc:71ab with SMTP id hc4csp2010898rwb; Fri, 5 Aug 2022 11:31:25 -0700 (PDT) X-Google-Smtp-Source: AA6agR4PwcmjcKFOVbzRSm9O8S7AGLg2SGr9y/J/87Nx+8q4qAumMKNGkF/py8b7h1C97XJiuLH7 X-Received: by 2002:a17:907:94d2:b0:730:87c1:e86c with SMTP id dn18-20020a17090794d200b0073087c1e86cmr6074454ejc.129.1659724285228; Fri, 05 Aug 2022 11:31:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659724285; cv=none; d=google.com; s=arc-20160816; b=NRns7vXE5/xEWMu4dDFlxGYo2HX1BAE7RfznVsl9yGQlBMsrslxoyH+4RnVg1dHFHd CUxxszDlRBsvqeyZTYj4SLfdcDm8JjGsmUcYlOfokTLuvDIWIdWHX+DJabUZMyMsQ1PD GY94JPCnWSB5AM2IlEgJm6B+bShi3du0kiWamcWyXZyr4s4DJrk1QwMHd5imCWTK14fh BkrI+auy6djZfUyWeJfy3xi1clHrGWdcISHLGZJGrNbwHS9qxQV+WmIBJ5wslTOhBsW5 CLmDa27D8fJL74MThfDicmD4qK6NHJw5/+zAejm1keTN9UrWlHO1xUYDhXjqWCAF6CMf UooA== 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:dkim-signature; bh=IzpiBFPwlBSeiyCmg4i8g32ALBSJCReWlJys+QhxFS8=; b=O3NbgRJmSHCUGVZ8KFtsDhP/Y9yA2J+mhY85YHoL0Tuc5ecpNj9nJVDuS9RedtvmME eqV0IJs24o3fvvL6h6kCK613SNBH4NgS+dYcw/enUj5gf2np56P2umWw3zJ8RgKEgr8p Kud4ahYpTW077Y7eOiMjoMpmbfnSnT4h/NFIwiyXdZIUU+WKpV9gSy1k/m8A0eWSoCLx 3kOBKjhjquW0ZyMHTxllCBYscawLvjCNYyFi/qTej/OvsGaVupHWMvDaJQwXaOJNdd4z 5GxkZc8yUxAOs4wOrRpkzjKoFE8FDfnxSPH21b+66A5KOpLn+0itKrRicIeSrHxTUFzw wUGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=HEvQrK0z; dkim=neutral (no key) header.i=@suse.cz; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m13-20020a056402510d00b0043bd77de21esi420239edd.51.2022.08.05.11.30.59; Fri, 05 Aug 2022 11:31:25 -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=@suse.cz header.s=susede2_rsa header.b=HEvQrK0z; dkim=neutral (no key) header.i=@suse.cz; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240804AbiHESR5 (ORCPT + 99 others); Fri, 5 Aug 2022 14:17:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53632 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229577AbiHESRz (ORCPT ); Fri, 5 Aug 2022 14:17:55 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5D9DA1A39D; Fri, 5 Aug 2022 11:17:54 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id EBF34349FD; Fri, 5 Aug 2022 18:17:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1659723472; h=from:from:reply-to: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; bh=IzpiBFPwlBSeiyCmg4i8g32ALBSJCReWlJys+QhxFS8=; b=HEvQrK0z2flbkWu3D4bi6Huu9V6B98l37hfFD6hspbwEp6re5HjF/Yu81/d71Yyh/aa1F+ I7BNV4EpToX8myv1isx7IZTxjYrhx+NnCFVLAfX32A2r8QXYROHSvRxSbFf4KLV/2UsIuJ ZVrU4VJ7qbcrVA8P4y+TSLkNjlt7Y+g= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1659723472; h=from:from:reply-to: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; bh=IzpiBFPwlBSeiyCmg4i8g32ALBSJCReWlJys+QhxFS8=; b=U1lAlK/bqMUOrKEDOATRLkf3iu/ZOAEGHfjjcQhARV8Kqz/D1wQ4Em8MU/QEXhid1WfmII 3k0L6l4IM75ob6Dg== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 7B519133B5; Fri, 5 Aug 2022 18:17:52 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id vqNoHdBe7WKZFQAAMHmgww (envelope-from ); Fri, 05 Aug 2022 18:17:52 +0000 Message-ID: Date: Fri, 5 Aug 2022 20:17:52 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.0.3 Subject: Re: [PATCHv7 02/14] mm: Add support for unaccepted memory Content-Language: en-US To: Dave Hansen , 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: Vlastimil Babka In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,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 8/5/22 16:41, Dave Hansen wrote: > 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. Rather not, as acceptance can be slow and we shouldn't hog the zone lock while doing it. > 3. Pull the page off the 2M/4M lists, drop the zone lock, accept it, > then put it back. Worth trying, IMHO. Perhaps easier to manage if the lists are distinct from the normal ones, as I suggested. > I'm not sure any of those other options are better.