Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp855450pxb; Wed, 13 Apr 2022 14:06:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyKOwS9xNoKKhiyHoKnAN04W7Jfy9rhMUnGZ1neOGyNH+F76pAZ3/aQrGXngHoA71pvBIGp X-Received: by 2002:a05:6402:1541:b0:41c:bfb9:d56b with SMTP id p1-20020a056402154100b0041cbfb9d56bmr45242995edx.344.1649883986826; Wed, 13 Apr 2022 14:06:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649883986; cv=none; d=google.com; s=arc-20160816; b=htTeBclxvlKi1hWx5I8gYfSjLmUEKvOdyOSTJUqdSTBKoGuCF4+53Jl0RNoc3A8vki 3xl3Y9B/GHHJmMh5+Y0FwSE5cvNT1tUh2ZJGdmQOEKjo6apyIYAVP7dA9Ht56bSz71Mv 7BptyavJsiAdWIMnKDGmhZe3rQT8QLUzK15MevuigYlM3y6VLhauhwWZC5iGz7/9dqt2 N/nJx5M/KhPaVnJXjHv5MylPHtowt++1U414mrdYfFsNpRhWy4iAjjfsJ7RL7HPG7Isl pOZCNprEZ5vLq1E4VVDvJuOHV9reGmIlZDORFDVOX2PQMBq0BxN1uTrg5fR9U9n/4zCe i9Gw== 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=EsxSjVG8kNa20sGc7UpfrBrGphyqTawiJapJvuQafrs=; b=lICMxiybFk8Ivm6G1788gbLCgAmzoV3QMFL7976nrEos3FPbB+eqiz0KezyV364DSh SV9e1dYdklTvK0uPlprWC2irYXfWNFgfWPjey8dODPSrny2GscfGP6LoZWERd/IkFPtz g1w9AkCWvkaWe2I6BspHtZmf2q/Jj7SZO4AdMV8p4qAKAczW67sC/kvqy6+XvOIRAesY 5wdBwCWbBVWTTQT5F2hIL6GRL/wEgjw8txtyTt1u6CMLedlbHYNS01nuGjnWp6KrjInF KW839pG3HQR8C0nQFbA+4XaToCyxweP9sxQF2lmE2zAisj+y+wjzO/W/A3rhBb1lGcnG 0jag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@shutemov-name.20210112.gappssmtp.com header.s=20210112 header.b="XdJ/dmKa"; 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 n3-20020a056402060300b0041d7a06cedasi2148781edv.433.2022.04.13.14.06.00; Wed, 13 Apr 2022 14:06:26 -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=@shutemov-name.20210112.gappssmtp.com header.s=20210112 header.b="XdJ/dmKa"; 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 S235407AbiDMQZT (ORCPT + 99 others); Wed, 13 Apr 2022 12:25:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47180 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231865AbiDMQZQ (ORCPT ); Wed, 13 Apr 2022 12:25:16 -0400 Received: from mail-lj1-x236.google.com (mail-lj1-x236.google.com [IPv6:2a00:1450:4864:20::236]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 10E0D3206A for ; Wed, 13 Apr 2022 09:22:55 -0700 (PDT) Received: by mail-lj1-x236.google.com with SMTP id c15so2836036ljr.9 for ; Wed, 13 Apr 2022 09:22:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=shutemov-name.20210112.gappssmtp.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=EsxSjVG8kNa20sGc7UpfrBrGphyqTawiJapJvuQafrs=; b=XdJ/dmKaqAlkeNmwHqVM6mC0GRFNdyHrqfVtwzNO4hqerVqgJWXDDNFBhdov8vLwKV PcNSkxa5aMFJNAAmvJVKGgl8l9HfbioaOSEWqaUx2eDF7mHVRZ2Pvvdq9uUco6g6F4QS KO02pXC98R/2tEy0DWmUmr0N8OBg5OF/UBBGtZeX/yaqRqxMC94FuG48VUl6vA/wpMC0 t2nwrne8NcmmC2wuCHugdPqdlgRLr1lM8Ew0yqpU/rwsVAtgZA0rYxA+AHFWX2OLn8rE I8/t3oT9BfUnxStoGwO7D4lFmtW7OcaJmDVHP55MKJuDAVYmchiwVAtrAuk197PppbKa SW0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=EsxSjVG8kNa20sGc7UpfrBrGphyqTawiJapJvuQafrs=; b=oQt+luuO1MKh26xp1CpzY5c0yQ73L2lRN5VU2LTiL23845wIPTgPuLGy7Q74pBdphl p1KH7UP0RTwJtjOeKLpeFFrzT99MFuHaBjh3u21q67gAgq0ZkirWL5zjmQJGOgIDG7Be DDf6QqO/ClY+q7nnjz9iwA/dU7JgT/RZAKwhKaF9yz3x7LxuYnXLtOEKq86xZuCzToe0 SmwT4jv1iC95DQO7W5pM7HdOCKIEGd62JH0SI7UUQwfsA8xHRplqwW6O35ueSYFQobuX V6R7JdbTYoJ4NSXFMXMJvouyLS9iTFjp4DRbgL5QouYWlYufJO4PVVICoUWuakraOkD1 xrQw== X-Gm-Message-State: AOAM532fV5i8qhXt2lufYkzmc9RTdd8h51oToMB2wW4jYSZw8pC5/jwI Dh0i24+fLmaik6BnWya7IqfVdg== X-Received: by 2002:a05:651c:a0e:b0:249:90c8:453d with SMTP id k14-20020a05651c0a0e00b0024990c8453dmr26224552ljq.399.1649866973168; Wed, 13 Apr 2022 09:22:53 -0700 (PDT) Received: from box.localdomain ([86.57.175.117]) by smtp.gmail.com with ESMTPSA id z24-20020a19e218000000b0046bbc65356bsm720143lfg.183.2022.04.13.09.22.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Apr 2022 09:22:52 -0700 (PDT) Received: by box.localdomain (Postfix, from userid 1000) id ADB2E104197; Wed, 13 Apr 2022 19:24:26 +0300 (+03) Date: Wed, 13 Apr 2022 19:24:26 +0300 From: "Kirill A. Shutemov" To: Dave Hansen Cc: David Hildenbrand , "Kirill A. Shutemov" , Borislav Petkov , Andy Lutomirski , 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 , 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 Subject: Re: [PATCHv4 1/8] mm: Add support for unaccepted memory Message-ID: <20220413162426.3sy6kjkaqvdgdbl6@box.shutemov.name> References: <20220405234343.74045-1-kirill.shutemov@linux.intel.com> <20220405234343.74045-2-kirill.shutemov@linux.intel.com> <93a7cfdf-02e6-6880-c563-76b01c9f41f5@intel.com> <20220413113024.ycvocn6ynerl3b7m@box.shutemov.name> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,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 Wed, Apr 13, 2022 at 08:36:52AM -0700, Dave Hansen wrote: > On 4/13/22 04:30, Kirill A. Shutemov wrote: > >> 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. > ... > > Frankly, I think option 2 is the worst one. You still CPU cycles from the > > workload after boot to do the job that may or may not be needed. It is an > > half-measure that helps nobody. > > Let's not be too hyperbolic here. "Worst" is entirely subjective and it > totally depends on your perspective and what you care about. > > There are basically four options: > > * Accept everything in early boot > * Accept with deferred page free > * Accept with kthread after boot > * Accept on demand > > and four things that matter: > > * Code complexity > * Time to a shell prompt > * CPU/Memory waste > * Deterministic overhead > > Did I miss any? "Time to shell" is not equal to "time to do the job". Real workloads do stuff beyond memory allocations. But, yes, it is harder quantify. > News flash: none of the options wins on all the things that matter. > We're going to have to pick one (or maybe two). I'm also not horribly > convinced that there's a problem here worth solving, especially one that > requires surgery in the core of the buddy allocator. > > This is essentially making a performance argument: it takes too long to > boot if we go with a simpler solution. Yet, I haven't seen any data. I > think we need to go with the simplest approach(es) until there's some > actual data to guide us here. > > Here's another way to look at it: > > > https://docs.google.com/spreadsheets/d/1Fpv0Yp0CTF5_JXHR2pywvNtImTwUVGTxDMlJ5t8qiis/edit?usp=sharing The link is view-only. AFAICS, complexity of the kthread approach is on par or greater comparing to on-demand. You need coordination between allocator and the thread. It can be hard to hit right balance for the kthread between being CPU hog and not providing enough accepted memory. -- Kirill A. Shutemov