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 B4A4EC433F5 for ; Mon, 16 May 2022 12:03:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 291D86B0071; Mon, 16 May 2022 08:03:56 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 240FD6B0072; Mon, 16 May 2022 08:03:56 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 109B56B0073; Mon, 16 May 2022 08:03:56 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 015686B0071 for ; Mon, 16 May 2022 08:03:55 -0400 (EDT) Received: from smtpin31.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id D02631484 for ; Mon, 16 May 2022 12:03:55 +0000 (UTC) X-FDA: 79471472430.31.000FF45 Received: from mail-pj1-f42.google.com (mail-pj1-f42.google.com [209.85.216.42]) by imf18.hostedemail.com (Postfix) with ESMTP id DC09D1C00BF for ; Mon, 16 May 2022 12:03:41 +0000 (UTC) Received: by mail-pj1-f42.google.com with SMTP id l20-20020a17090a409400b001dd2a9d555bso14149203pjg.0 for ; Mon, 16 May 2022 05:03:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20210112.gappssmtp.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=R84IxflJzQsjcs6liOC1xGi2RLfZVO/J/zvMOYtMBKI=; b=W7DK2qATwEyfvh21pVCPdp+fSj3B28j0KvO+lqsOPxPZIH7RUOgXti2vLaZX56uPLi Zf54oYdtq6IyZAvY5uSVv4DttuV81ENkrczCOrwjaDIK6BuZ9TEuvUnmtPYCDQda5SK1 2UJO3Wpu94Gdhwd/Yp8g9Rz4sXJ3VK/C2xxsZHY0ElYNMbFV7cttoOT3unYS/7uyE5ZQ PCp8z3w4j1eNrioDSgF9sfHye+GKmDpwe/cqZLfIukhxqI9gEH+uocUTdY3ZuzdW8+Rr 8/PJoYZ+p6cGNJWT50couq1k2JPjXlYhEQyNWCCb7k0tVbkNVfl77lsAuuK09mYxx+sm 4Ttw== 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=R84IxflJzQsjcs6liOC1xGi2RLfZVO/J/zvMOYtMBKI=; b=fpu+n9r2c2gYn+dduFbB1+piSETnfmpNAW/gmY3aLV8XjWnXsenHo3cjuKc2BAW0eF Tf3zvJHGjQBPR525Pz/BgoZSAdUOtJw6pBlSfKcuaKt0xfC6n8YlxVsPwLokAT3DyJBV qFJnIBalGgfdAXUcHXoLzNqc7DUgSzTXn+o0R7OQgkx8uJAyyuWGYSWnWAnVwCZPI6G5 yaOt9hXXMTyTLyhxlAiCMhnwcc/LpTGcmgjb7LHXsfJ3V+JAzURBv8RgaKig1ETWPfK8 xeGMpk5O06t3iVIjeOBhX+wKXF8nyFm9II/3h3WzcGTMdGZuzeSpTm3SCD7orrDjTwYk Mjsw== X-Gm-Message-State: AOAM530GTLXxIFDIu0pB3uKtf3HjwfmdmwL9mkRcXZXzedxOSec8vQBJ V6A1o20mWTZYCIUXAaKihNGP/Q== X-Google-Smtp-Source: ABdhPJzxfHYjLSn309uprN3vFeZ39gfOTL/8yBip6LIvpYKa3y23U3WenfTaxzCyUzgFpLJTj7UIKw== X-Received: by 2002:a17:90b:48d1:b0:1df:4fc8:c2d7 with SMTP id li17-20020a17090b48d100b001df4fc8c2d7mr5686526pjb.45.1652702633331; Mon, 16 May 2022 05:03:53 -0700 (PDT) Received: from localhost ([139.177.225.234]) by smtp.gmail.com with ESMTPSA id n22-20020a056a0007d600b0050dc7628139sm7015117pfu.19.2022.05.16.05.03.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 May 2022 05:03:52 -0700 (PDT) Date: Mon, 16 May 2022 20:03:49 +0800 From: Muchun Song To: Oscar Salvador Cc: corbet@lwn.net, mike.kravetz@oracle.com, akpm@linux-foundation.org, mcgrof@kernel.org, keescook@chromium.org, yzaikin@google.com, david@redhat.com, masahiroy@kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, duanxiongchun@bytedance.com, smuchun@gmail.com Subject: Re: [PATCH v12 4/7] mm: hotplug: introduce SECTION_CANNOT_OPTIMIZE_VMEMMAP Message-ID: References: <20220516102211.41557-1-songmuchun@bytedance.com> <20220516102211.41557-5-songmuchun@bytedance.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: DC09D1C00BF X-Stat-Signature: jbub5qjuiftqm9myf7z97d1znafybq48 X-Rspam-User: Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=W7DK2qAT; spf=pass (imf18.hostedemail.com: domain of songmuchun@bytedance.com designates 209.85.216.42 as permitted sender) smtp.mailfrom=songmuchun@bytedance.com; dmarc=pass (policy=none) header.from=bytedance.com X-Rspamd-Server: rspam09 X-HE-Tag: 1652702621-480138 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 Mon, May 16, 2022 at 12:38:46PM +0200, Oscar Salvador wrote: > On Mon, May 16, 2022 at 06:22:08PM +0800, Muchun Song wrote: > > --- a/mm/sparse.c > > +++ b/mm/sparse.c > > @@ -913,6 +913,13 @@ int __meminit sparse_add_section(int nid, unsigned long start_pfn, > > ms = __nr_to_section(section_nr); > > set_section_nid(section_nr, nid); > > __section_mark_present(ms, section_nr); > > + /* > > + * Mark whole section as non-optimizable once there is a subsection > > + * whose vmemmap pages are allocated from alternative allocator. The > > + * early section is always optimizable. > > + */ > > + if (!early_section(ms) && altmap) > > + section_mark_cannot_optimize_vmemmap(ms); > > Because no one expects those sections to be removed? > IIRC, early_section + altmap only happened in case of sub-section pmem > scenario? Right. The commit ba72b4c8cf60 ("mm/sparsemem: support sub-section hotplug") has more information. > I guess my question is: can we really have early_sections coming > from alternative allocator? > We can't. The early section does not consider partially being populated currently. > I think this should be spelled out more. I think you mean add some comments here to describe the case of early_section + altmap, right? Thanks.