Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp265768iog; Fri, 17 Jun 2022 03:16:18 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tMOR5kg12ukQdo5IF7JvsCYmM+UwxYAqaCI7RJZ8Vj6ySCbGWNt0vymHm66j1lAG6NpAlR X-Received: by 2002:a63:c65:0:b0:401:a9bc:7f17 with SMTP id 37-20020a630c65000000b00401a9bc7f17mr8352402pgm.166.1655460977869; Fri, 17 Jun 2022 03:16:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655460977; cv=none; d=google.com; s=arc-20160816; b=cEKCgeijH+g1MiSP7f68CzTZ0o09BMCkqxTesZT8KbOg9sHjZfVji3tzzXTEiYZxp0 uSf+Lnxl7kQt3hSevQJ+woclQZ5Fc3xRjYy/IwsvJBd3gahHVB+PBd7fgh/LocBa+EH1 lCk42lTbcDrvr7Yb1pu9o5v6wryUK8IbmTrz/3iPYycRTWQ/5JmVJyG/FROGSlYbUa/A J8yE8q1NMlmOZmAyF7s4OkB6P9eqaF4nc032hHWJc5SfcJtH5hcqjvONE1NtRbuZ85/I W/XXQqHJz3JQe/T1OT8VNgElBTBuBYH4WA1DBnUd+XRWS5A7Dz5tGtlKd5yWXf0hbwZ/ JwUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:subject :organization:from:references:cc:to:content-language:user-agent :mime-version:date:message-id:dkim-signature; bh=OO/vzqKXxtmhmREmRXYJJgBI7tFlamAdTQoTX2eqNDk=; b=y9BlCl+v9OC11t0HYcv1VgN8o1HeCq5FSXuAuCWNuyZHZp1gcGRFkqxDowqx0BDcVQ HmCU3UdhMuE3BwQGKoJV78bYq1YDh3szbd1xyYfBRGedEeRxJJWU3I5b4aovJ1Gv5QQD iU3jSDeCx2w4nB+kkbAceuel5GH/jd/4WDL2OIOf5WijX4xzzqVgYgX6yVcA9dBNrnXR ZrWQTgvIExAEy9GTJRIHF8BV2FAsIYlylGPeOCK2tm6ptVW0qUwtlI2r6IQTnZVUjnk2 g4qIAtlv7wZDDmJeMvMRK1F6eSYpI/+r/AvXHlLSNVNM/gkpw99HR+12HCTpyVtLsJMH Omcw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=GWPkoTSQ; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d18-20020a170903231200b00168c7a3808csi5911007plh.210.2022.06.17.03.16.01; Fri, 17 Jun 2022 03:16:17 -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=@redhat.com header.s=mimecast20190719 header.b=GWPkoTSQ; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1381712AbiFQKOM (ORCPT + 99 others); Fri, 17 Jun 2022 06:14:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33834 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1381719AbiFQKOK (ORCPT ); Fri, 17 Jun 2022 06:14:10 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 98B7D6A055 for ; Fri, 17 Jun 2022 03:14:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1655460846; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OO/vzqKXxtmhmREmRXYJJgBI7tFlamAdTQoTX2eqNDk=; b=GWPkoTSQW1cXR9tZjTTR2CIbJDiJY9iP0Be6aehgk8Dcz3haU9L0VHiIWAkcsbfZ7QdRr4 viTxSs8QrmtoKLCMCDjfV1FDF/Xuwvrgkd5SwjyDNSYewZMVIAR4G8vPiFandWXwtG/Ql5 pw7syzFMxdpdfyTlkruULcHqa5kZeW8= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-574-ZoBAubxPPJ-Ew5wSyzjeiw-1; Fri, 17 Jun 2022 06:14:05 -0400 X-MC-Unique: ZoBAubxPPJ-Ew5wSyzjeiw-1 Received: by mail-wm1-f70.google.com with SMTP id p24-20020a05600c1d9800b0039c51c2da19so3650863wms.0 for ; Fri, 17 Jun 2022 03:14:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent :content-language:to:cc:references:from:organization:subject :in-reply-to:content-transfer-encoding; bh=OO/vzqKXxtmhmREmRXYJJgBI7tFlamAdTQoTX2eqNDk=; b=UzZTPXJBMLkNIRtXGvokKZI6LA9Z/denDDnxFOBPzrVssQIUpv0Pjrp91XaKeftvX+ haVTM/yE2tPnlUqsNMHZdVjwMz3M7mSqEe1/3KeZEja6J2bjuZVHO7JDB/A7hI+LsCpr UComgYycsZ6ODSye9XkG76NWzb3X/mfYb84IkFfgHXruLIII32j3rRhBMOZwtQDI4FLv jaqrXpIhs63fWxcKl0slxowfxFaNreFqb5wu1g1e95tVsxx/6yrPci7KlEJdv02s9yaW zTJiXSj8kC735l+0F9IfW89yh+PGzybzu3fSqEDeVVkel09zy3cduz51U9WMRVFTrQli Cvbw== X-Gm-Message-State: AOAM5326otqw5fnva7ErqKyVF2gEGuzVCgp/BDskG6HWFuvvEnn1hoD/ B7n87ImYq1N+Itydf2mpnKt86JoYfVrdPAnepwPR/OMc1FjlMK38HadX+L9uqp6nV6u572TpOj3 MMFq/6PQDIXMHfxH0J/mP2QHL X-Received: by 2002:a05:600c:4f47:b0:39c:62cc:75da with SMTP id m7-20020a05600c4f4700b0039c62cc75damr20098276wmq.114.1655460843747; Fri, 17 Jun 2022 03:14:03 -0700 (PDT) X-Received: by 2002:a05:600c:4f47:b0:39c:62cc:75da with SMTP id m7-20020a05600c4f4700b0039c62cc75damr20098249wmq.114.1655460843470; Fri, 17 Jun 2022 03:14:03 -0700 (PDT) Received: from ?IPV6:2003:cb:c70a:7e00:bb5b:b526:5b76:5824? (p200300cbc70a7e00bb5bb5265b765824.dip0.t-ipconnect.de. [2003:cb:c70a:7e00:bb5b:b526:5b76:5824]) by smtp.gmail.com with ESMTPSA id q17-20020a056000137100b002183ee5c0c5sm4276786wrz.50.2022.06.17.03.14.02 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 17 Jun 2022 03:14:02 -0700 (PDT) Message-ID: Date: Fri, 17 Jun 2022 12:14:02 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.0 Content-Language: en-US To: Oscar Salvador Cc: Muchun Song , 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 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> From: David Hildenbrand Organization: Red Hat Subject: Re: [PATCH v2 2/2] mm: memory_hotplug: introduce SECTION_CANNOT_OPTIMIZE_VMEMMAP In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-5.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 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); Not sure, though, if that would work with that function. -- Thanks, David / dhildenb