From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-lj1-f171.google.com (mail-lj1-f171.google.com [209.85.208.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5BF70290C for ; Wed, 13 Apr 2022 16:22:55 +0000 (UTC) Received: by mail-lj1-f171.google.com with SMTP id a8so2613017ljq.5 for ; Wed, 13 Apr 2022 09:22:55 -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=xcd/9bM9fxZNpJACvwLAtb/Em/I2RFRm+QuY6eBOXca9HIH67Ic9qOQ4L/OMm+tBKw J5XUHjmTo3Kw1k0XIpZxLrV/z5zNZp3vE4cMYO90KIzd2pKMdEqM3AOc/ITAHsuhRef7 BFEla3sOH2iJSD6cZFxFuU42j51x0JO1saCuJhmsqtGbcZEJL7wCzsVT79tr2H052wmR XFCgngdyu55SCbVG2ovm0tR2Tcl2+NqaNumQjpHMHFsLVXZPz2D4D+RKzVQ9vm7hG/tP rCqi2dGrNZ106mFQFylRmQ7NgPXRwLjySEEC9xeeGjhQjz8PCSkTV3ZASRhnSrG+Hu0W j0zg== X-Gm-Message-State: AOAM530eE8V+ebWtLBGvdWZuj65Op0nHp1v3ve0rLNYIjkrAL/nWsT3W LOwKHZN8439ow6oM8YrHTBAamw== X-Google-Smtp-Source: ABdhPJxItrR8spBKK0GKnFxBDIgY0Ti2eyMcpmcgx5QL2y7Tgx8HR9MxVY8Qex9KNQICbLsriZt2ig== 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> Precedence: bulk X-Mailing-List: linux-coco@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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