Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp1232390pxb; Thu, 14 Apr 2022 01:05:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx8+GqRoeSZxlmc+CVjvMOHFy4ixpVDLtAVkLso0P4CjQx95yuKV2u+crvW+Llo5k9xgsao X-Received: by 2002:a17:907:1c97:b0:6e8:f888:e6a with SMTP id nb23-20020a1709071c9700b006e8f8880e6amr1277090ejc.166.1649923525066; Thu, 14 Apr 2022 01:05:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649923525; cv=none; d=google.com; s=arc-20160816; b=ea/p6ZJM0bfdWa/f6YTr2q5Ico39bS9KATEjW1v4CZR70EM/5ARm9qBP8wE/5Mez9V SrV1b6RsbLHF0juWYh5688JsR22+IAU0qaE2NdspQWLjkeSX2h+mIgQtBL1Wi/sWtVLj 36ccXyZd4ncNyEESybp300/KolOCXfvzfxLtoVsuS2zFQ9fSzSSYxOKvaWIw3/fiUKba fx6rL+OfqBwpbRes33t78UC4fwy0tTj36lD3zVWlwh+QIk0JK770DlfwC8V/DmBT880t oUct72pOEgOLYbD5Bvcg4ktL6clPVj4QKXHnrLcvqRCZyWRjysvY7kxLVDJlH9y1cGh+ e7AA== 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:subject :organization:from:references:cc:to:content-language:user-agent :mime-version:date:message-id:dkim-signature; bh=Gww3nqiIUaE/hiebhaeJWaOYoxyisvc31A4eZ4yYvpw=; b=Qyd5kWrm45qYKH4jbD3AfV9rOoAB4pwN4F87v/jZDz3s4L9IYFnFthyDXXvW/tmxF9 mweIkfhSYkHDqrW5wUuWyoxCdegD+1BJveEHa4C9hkpHfuqBuMtpNhIxfHpYKDgFy84s KdNmEaHQ8Q3EoC3kDwXxRr7oY+Ofo9KyklwcPZFcx8Qa3xeBBsCpVU9zZTRl2WUj7Ir9 gpZgAx+QX/hsEJxmgmovT6c58Af0KbuKJLNNYCU8gkJMhuuGhBBrATJ6gJaT6VyXq/Cg hO441yh1lw7Bw0pI9enwQjqArgb9jylgnJKXzMhMw0TceRJksuP+I3OJ817KPzT+hHy8 99Pw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="D/o6iWCC"; 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=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j3-20020a170906430300b006df76385d90si1430601ejm.560.2022.04.14.01.04.59; Thu, 14 Apr 2022 01:05: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=@redhat.com header.s=mimecast20190719 header.b="D/o6iWCC"; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235055AbiDMKjq (ORCPT + 99 others); Wed, 13 Apr 2022 06:39:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60304 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235053AbiDMKjI (ORCPT ); Wed, 13 Apr 2022 06:39:08 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 3D2155AED4 for ; Wed, 13 Apr 2022 03:36:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1649846184; h=from:from: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; bh=Gww3nqiIUaE/hiebhaeJWaOYoxyisvc31A4eZ4yYvpw=; b=D/o6iWCCiHFf36TMJwtVhccAYOv7/j7sLqzw/l2StI6Aj3SIHsVfN+b2qh+z/7ak1sImlK FD5RYSsoHFsL9ZeBRvRUwSQdODyhhXMAnDmj1Eat0gvFLLxC6TsDc2IcTilWQrpHzfrkmw UN8yWA+jyI8E39fvA57e/3XjZSeRdEY= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-588-Mb6edyh7NmCGrclbQbZv7A-1; Wed, 13 Apr 2022 06:36:15 -0400 X-MC-Unique: Mb6edyh7NmCGrclbQbZv7A-1 Received: by mail-wr1-f70.google.com with SMTP id t15-20020adfdc0f000000b001ef93643476so249468wri.2 for ; Wed, 13 Apr 2022 03:36:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent :content-language:to:cc:references:from:organization:subject :in-reply-to:content-transfer-encoding; bh=Gww3nqiIUaE/hiebhaeJWaOYoxyisvc31A4eZ4yYvpw=; b=QH7mHLK5H8F2NiarMqroowFxHGfUtMsZBFi5c4FUnEMsvAEbIuM+VdZo5ectqnKM5w HxN2e8E11X7fdkhGRf4O6dyfqCDRMxYc0/3a+kfp+oBaweVYVPPLIHSQPMAcQPP1OogV flok9FeXM94VPbINtdj7yH6uaUQ0Oz8YehciAXV9aoX8+NR7rbAMJydwKSDFWHIR22Na bMN+P50fBcCBn3Ru66mqCfJH0qiGUCWjFLhYl7w42/x5M911Fxh9UtvF06ghimmEx2hJ 0A/AAzHbyhWVYQXYKwh1HR7GIaSCm+AQvONKGPTVCuS2FEAdP2tspEs8zbsVv24xFanl Qvww== X-Gm-Message-State: AOAM533Ej+lX3NgJkNs0qIo706gcBG0VCOh2ras628RvqLCNznwqbXYZ /uH+0nJO9NW0bZNfGChxrqGt0zIVm4jMljLjGciE5MIyXEHa1rDb68YSF4Wb9snZKI+bi1jK04G jOV+19nLectzy8Ogczc9Rh/Dz X-Received: by 2002:a5d:47c3:0:b0:204:5b8:225c with SMTP id o3-20020a5d47c3000000b0020405b8225cmr31433834wrc.474.1649846174386; Wed, 13 Apr 2022 03:36:14 -0700 (PDT) X-Received: by 2002:a5d:47c3:0:b0:204:5b8:225c with SMTP id o3-20020a5d47c3000000b0020405b8225cmr31433796wrc.474.1649846174092; Wed, 13 Apr 2022 03:36:14 -0700 (PDT) Received: from ?IPV6:2003:cb:c704:5800:1078:ebb9:e2c3:ea8c? (p200300cbc70458001078ebb9e2c3ea8c.dip0.t-ipconnect.de. [2003:cb:c704:5800:1078:ebb9:e2c3:ea8c]) by smtp.gmail.com with ESMTPSA id t6-20020a05600c198600b0038cafe3d47dsm2255442wmq.42.2022.04.13.03.36.12 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 13 Apr 2022 03:36:13 -0700 (PDT) Message-ID: Date: Wed, 13 Apr 2022 12:36:11 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.6.2 Content-Language: en-US To: Dave Hansen , "Kirill A. Shutemov" , Borislav Petkov , Andy Lutomirski , Sean Christopherson , Andrew Morton , Joerg Roedel , Ard Biesheuvel Cc: Andi Kleen , Kuppuswamy Sathyanarayanan , David Rientjes , Vlastimil Babka , Tom Lendacky , Thomas Gleixner , Peter Zijlstra , Paolo Bonzini , Ingo Molnar , Varad Gautam , Dario Faggioli , Brijesh Singh , Mike Rapoport , x86@kernel.org, linux-mm@kvack.org, linux-coco@lists.linux.dev, linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org, Mike Rapoport References: <20220405234343.74045-1-kirill.shutemov@linux.intel.com> <20220405234343.74045-2-kirill.shutemov@linux.intel.com> <93a7cfdf-02e6-6880-c563-76b01c9f41f5@intel.com> From: David Hildenbrand Organization: Red Hat Subject: Re: [PATCHv4 1/8] mm: Add support for unaccepted memory In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.1 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_LOW,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 12.04.22 18:08, Dave Hansen wrote: > On 4/12/22 01:15, David Hildenbrand wrote: >> Can we simply automate this using a kthread or smth like that, which >> just traverses the free page lists and accepts pages (similar, but >> different to free page reporting)? > > That's definitely doable. > > The downside is that this will force premature consumption of physical > memory resources that the guest may never use. That's a particular > problem on TDX systems since there is no way for a VMM to reclaim guest > memory short of killing the guest. IIRC, the hypervisor will usually effectively populate all guest RAM either way right now. So yes, for hypervisors that might optimize for that, that statement would be true. But I lost track how helpful it would be in the near future e.g., with the fd-based private guest memory -- maybe they already optimize for delayed acceptance of memory, turning it into delayed population. > > In other words, I can see a good argument either way: > 1. The kernel should accept everything to avoid the perf nastiness > 2. The kernel should accept only what it needs in order to reduce memory > use > > I'm kinda partial to #1 though, if I had to pick only one. > > The other option might be to tie this all to DEFERRED_STRUCT_PAGE_INIT. > Have the rule that everything that gets a 'struct page' must be > accepted. If you want to do delayed acceptance, you do it via > DEFERRED_STRUCT_PAGE_INIT. That could also be an option, yes. At least being able to chose would be good. But IIRC, DEFERRED_STRUCT_PAGE_INIT will still make the system get stuck during boot and wait until everything was accepted. I see the following variants: 1) Slow boot; after boot, all memory is already accepted. 2) Fast boot; after boot, all memory will slowly but steadily get accepted in the background. After a while, all memory is accepted and can be signaled to user space. 3) Fast boot; after boot, memory gets accepted on demand. This is what we have in this series. I somehow don't quite like 3), but with deferred population in the hypervisor, it might just make sense. -- Thanks, David / dhildenb