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 B3586C433F5 for ; Wed, 13 Apr 2022 16:22:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0EB466B0074; Wed, 13 Apr 2022 12:22:56 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0722D6B0075; Wed, 13 Apr 2022 12:22:56 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DE08A6B0078; Wed, 13 Apr 2022 12:22:55 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0165.hostedemail.com [216.40.44.165]) by kanga.kvack.org (Postfix) with ESMTP id C36E36B0074 for ; Wed, 13 Apr 2022 12:22:55 -0400 (EDT) Received: from smtpin28.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 6D2A58249980 for ; Wed, 13 Apr 2022 16:22:55 +0000 (UTC) X-FDA: 79352374710.28.C9FAC74 Received: from mail-lj1-f174.google.com (mail-lj1-f174.google.com [209.85.208.174]) by imf26.hostedemail.com (Postfix) with ESMTP id E8A5114000A for ; Wed, 13 Apr 2022 16:22:54 +0000 (UTC) Received: by mail-lj1-f174.google.com with SMTP id m8so2843037ljc.7 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=Ydeio8cNPWNCtmvfTQ4nFLkAAeWaEsf6XJ8EvzpijAx0R1WKsVkBcrrKavz6sU/knx Vj4iOPHdvFn1Zo+EkhnEMjCa5sr8r7BorT+81Hrkes4IRMesBRCl4MkZxBy/PnIIvFx8 lP/FTqfUexPAEmgIe9ZgREYNwvjO2D3eIXd1Pz+8yAp3kZu4AlOMjT5GOulYToxkBeny msAkjoczYVQqDwKNLE5DDoEvwnlzGo5UE5GyBudqNwyYjhwA0MIsKzDIerK7gdG7CdWj Rg0WPw3zKo8jPNw+qODa3zThuJCWRyiyrs1KXniUHdL9XktQgRzyBwasV3JRLQXj0oNg MT+A== X-Gm-Message-State: AOAM533NDxRTxGzvsgeTlVmt8JCEU8nkequ9Jmll2s+ltxHD6T0r2z4S 2AVrQXCPIfREnOjq8wUoNuI6Aw== 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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Stat-Signature: t9us36a569bg8ch36hraqjahjmdjs68h Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=shutemov-name.20210112.gappssmtp.com header.s=20210112 header.b="XdJ/dmKa"; spf=none (imf26.hostedemail.com: domain of kirill@shutemov.name has no SPF policy when checking 209.85.208.174) smtp.mailfrom=kirill@shutemov.name; dmarc=none X-Rspam-User: X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: E8A5114000A X-HE-Tag: 1649866974-118281 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 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