Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp322559iog; Fri, 17 Jun 2022 04:23:51 -0700 (PDT) X-Google-Smtp-Source: AGRyM1smytxz4HmHIBDLyHKQqeqPFRoe+h5d4B00wj1A2XfTSiFsmpARnkLwB7UebWYXYiJvE4it X-Received: by 2002:a17:906:7d48:b0:704:e88c:2af9 with SMTP id l8-20020a1709067d4800b00704e88c2af9mr8517008ejp.165.1655465031334; Fri, 17 Jun 2022 04:23:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655465031; cv=none; d=google.com; s=arc-20160816; b=PbJlV0avXR6i86zWlew43/hlrMEHZBqVp0BcqOXTszgcKXBD19iye3eP6dZFsKAtBC Bvvhv4Oc3hE7jg4tMnkccKmaOCjuUTEhn2fZsohRgOWcgWhnaV4ZFdZmX+7cEzuvk+Ih F+ahMIxv13yLsRvHhWWYpCCuJ6t3EhdrtVUdN5N6clAdUlQ6CSJHWCr1x9tsFROPb+kz YETiVjP8tmSUBe6cm1uLUd0M/HwKILZrusyJEKxltXm86by+8kvT+jHM9OPT4XpCe8nJ EY6+y5VbjGZCGDgfeoeN8n19a+V2ifxzUcQ55H0vQK9L/3XHzFVjSt7+NxiWF4tTcxqq yjMg== 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=etXBBicoFjC7mauli6ZHZX7BG/ZNUXKeXrOBV6F93AY=; b=KVE4JUnBXbftn576qnlVGx66XbpJzr+Gg4knwPRLb7ZtA5HKXsCZQCbvB6dABmxq3L Qk2Bo5hHm19pMp85gi2D2h46MkIyNqOumyj/b90tYwAoXY/Taj7wRucwUm1sekp98zH3 3AYff104lP/8wfQdpfpkLVtigZHitsdE+088SkaGeCod6eANGjdB45po3yd0EogBfe73 7NpHdpOaDYivpzSXB0IQ27LJobnqeIJtyYnDvw3q5luBoLvHOkJz678+xvkWcxbduQNw mO0RMW2+WKeLP9CPsQupy9VinMaaxJvuYjZ2HkCbxZ7VPnG00WpANeQ/Ebm5Mr9gYBIc JvsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=phOPovKH; 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=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r15-20020a50c00f000000b0042de64ca253si5704264edb.397.2022.06.17.04.23.25; Fri, 17 Jun 2022 04:23:51 -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=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=phOPovKH; 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=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382197AbiFQKtZ (ORCPT + 99 others); Fri, 17 Jun 2022 06:49:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47442 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1381964AbiFQKtX (ORCPT ); Fri, 17 Jun 2022 06:49:23 -0400 Received: from mail-pg1-x532.google.com (mail-pg1-x532.google.com [IPv6:2607:f8b0:4864:20::532]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EE2496BFD4 for ; Fri, 17 Jun 2022 03:49:21 -0700 (PDT) Received: by mail-pg1-x532.google.com with SMTP id l4so3735348pgh.13 for ; Fri, 17 Jun 2022 03:49:21 -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=etXBBicoFjC7mauli6ZHZX7BG/ZNUXKeXrOBV6F93AY=; b=phOPovKH8vP2s1pV55Oz4O6ZizKxeZx4XrG7NbWmMDl9mdvr6v9wxQZhD7lVI0R65J f2UXcYlGmvoY3TpDJk3ZRarSzlAsBejReHOfOcduB8QmyyXlvA+cdT3Xon6kWzmWh3eh GN1LYq1wHvw2jIHI9hN//SttSFlIqFcUxDpUSnX4Y+Xs09QKhDChKmczX4+Gv/JCGiXi SWkxGYEIfP3UvGh/YCSPY58I1H6hwg2VnZPkkVVTdY6bYZ8eN087igliOZzPyxDEAEb5 VT2FQ23kpboFQH9J6EjeL1FXu+3hwfygdVZyCETPFgRNTdjYVEVqxLthIvGXW3HJxwxN aB3A== 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=etXBBicoFjC7mauli6ZHZX7BG/ZNUXKeXrOBV6F93AY=; b=NteNC8/nfepq+GD0vDGHUrwwLMSKeC8Ep0DW/l8ZLVvj/hEUOW/P4/zGIJx7UVj52M L/Q2H77Vpn54ufBX6HJ9aZSNWVNYLb4xjyVcv30bEB0dumpbK3KWoTlPowOFkwPGJ9NP Nt8AYwesx+iTKjtoA18HKZNDEsPr4jd+aEhKOUS4VopL08pSRIuOqPzSKGokBb496UU6 8zg+vsEMj4tBkduYiWhkGvXC1IvKIMde4l/DR6/2XCapoqsmUOC08JOOByR/Za35tFW+ oxdKcdsdIoUbMigGIV3VQVD+wPcV4LelTruR09aRqf6M0m6I7TjRYNnT2kbFNBsukXj4 3ZtA== X-Gm-Message-State: AJIora+icMAWbA7yQOizD4lgq4YKNGBk+20SQAQdJvKooEwo1vkzyCf4 3BTFnYmJQMA6gq6x4Uy2cCS35g== X-Received: by 2002:a65:6254:0:b0:405:559:a90a with SMTP id q20-20020a656254000000b004050559a90amr8407085pgv.480.1655462961483; Fri, 17 Jun 2022 03:49:21 -0700 (PDT) Received: from localhost ([139.177.225.255]) by smtp.gmail.com with ESMTPSA id az9-20020a170902a58900b00167838b82e0sm3219194plb.205.2022.06.17.03.49.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Jun 2022 03:49:20 -0700 (PDT) Date: Fri, 17 Jun 2022 18:49:15 +0800 From: Muchun Song To: David Hildenbrand Cc: Oscar Salvador , corbet@lwn.net, akpm@linux-foundation.org, paulmck@kernel.org, mike.kravetz@oracle.com, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, duanxiongchun@bytedance.com, smuchun@gmail.com Subject: Re: [PATCH v2 2/2] mm: memory_hotplug: introduce SECTION_CANNOT_OPTIMIZE_VMEMMAP Message-ID: References: <20220520025538.21144-1-songmuchun@bytedance.com> <20220520025538.21144-3-songmuchun@bytedance.com> <53024884-0182-df5f-9ca2-00652c64ce36@redhat.com> <24d5ec20-9c9e-93aa-11f4-c4619f51f7d1@redhat.com> <186924ab-651f-71a1-93d2-3500a67dffee@redhat.com> 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_PASS, 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 Fri, Jun 17, 2022 at 12:14:02PM +0200, David Hildenbrand wrote: > On 17.06.22 11:54, Oscar Salvador wrote: > > On Fri, Jun 17, 2022 at 09:43:33AM +0200, David Hildenbrand wrote: > >> VmemmapSelfHosted, then the function names get nicer. > > > > Definitely. > > > >> > >>> +#endif > >>> + > >>> /* > >>> * On an anonymous page mapped into a user virtual memory area, > >>> * page->mapping points to its anon_vma, not to a struct address_space; > >>> diff --git a/mm/hugetlb_vmemmap.c b/mm/hugetlb_vmemmap.c > >>> index 1089ea8a9c98..e2de7ed27e9e 100644 > >>> --- a/mm/hugetlb_vmemmap.c > >>> +++ b/mm/hugetlb_vmemmap.c > >>> @@ -101,6 +101,14 @@ void hugetlb_vmemmap_free(struct hstate *h, struct page *head) > >>> { > >>> unsigned long vmemmap_addr = (unsigned long)head; > >>> unsigned long vmemmap_end, vmemmap_reuse, vmemmap_pages; > >>> + struct mem_section *ms = __pfn_to_section(page_to_pfn(head)); > >>> + struct page *memmap; > >>> + > >>> + memmap = sparse_decode_mem_map(ms->section_mem_map, > >>> + pfn_to_section_nr(page_to_pfn(head))); > >> > >> Why can't we check the head page directly? Either I need more coffee or > >> this can be simplified. > > > > Uhm, maybe I'm the one who needs coffe here but we have something like: > > > > [ hot-plugges section ] > > [memmap pages][normal pages] > > Oh, right, we need the memmap for our hugetlb page (which resides in the > reserved section), but these are not marked. We need the memmap of that > memmap. > > I assume one could directly via the page address. Because we want the > memmap of the memmap. > > vmmemmap_page = virt_to_page(head); > I think this can works, more simple. Thanks. > Not sure, though, if that would work with that function.