Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp2700973iog; Mon, 20 Jun 2022 02:49:43 -0700 (PDT) X-Google-Smtp-Source: AGRyM1unh0YMQlxAVud4FpBQXlTX50ZzcnkRRU69znrZupxYDX12DlyFbikHC6NAgLqhqvucqF0z X-Received: by 2002:a17:907:1b1c:b0:6fe:f1a9:ef5a with SMTP id mp28-20020a1709071b1c00b006fef1a9ef5amr20168210ejc.233.1655718583144; Mon, 20 Jun 2022 02:49:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655718583; cv=none; d=google.com; s=arc-20160816; b=MCpdQHjvOHlBO6/urIvMR7dA9KCTY8ChNSc0MzOaZTZ2N0wq4DEVknPRWwtY6fgG1J w5nX26u3buevuBPSuDZ/OTXQZFCdZpt1Sfv6HaLvDH/OwMNxJHMAkjop+KxKG/1mvv6a 9Hh0q/hvd+NMXugLZt4Spq8WqOrD1llc0wDE11v8Z1SviSqe4gZPqIp5hH9oCefeAjMJ SvkpcLPEizKA+3TXo+pyvocSksj0lf6MGOUDfn06iA9szobPnOS/jKZu9WLeI1H8dRF3 4oQptAGJrtJr3OFTGmOVt7IfVzLmRJfak4g0QYpjggkeNtTg6oU7Bh/oE+VeazqzTYCZ am1g== 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 :organization:from:references:cc:to:content-language:subject :user-agent:mime-version:date:message-id:dkim-signature; bh=QEyy/6JZbSt5hhSc4lO1WFt1fgnwbmapR64qYRXGvPc=; b=D7lhDE790dYoSAwdCZsT0MoVTo+CVc3t6FyTZmnJvsbPuB0ouqdQNqeUzR5psld+Yd LdJJlPz3sr/Ep9Zm1xQqqdTQMntM78XoWA1KWaHVWhCFRzDaUUTGNVVk0E2Cf3ZT2oM0 3qkfzATky4SeBKaq1l1wWSqEY5O1DNeRdINTxd16H5fAZfyXZ1OTSoHCcgi203oPV7/o 9LH4hXLqvPHqwHLeVjg00CRBtGh2BcWDID+YeB/7wKxumeU3YL7mSmKUJu1W8rAf9BRh fRh4cbxttMjxui4NdVUqboR5nlHHyhl/MTICfvucHAod2yDE8VuNwgDAg6flPvT663/y N9sA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=HPIKtSN1; 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 hd11-20020a170907968b00b00718d1cddac7si12930811ejc.2.2022.06.20.02.49.18; Mon, 20 Jun 2022 02:49:43 -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=HPIKtSN1; 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 S240354AbiFTI4L (ORCPT + 99 others); Mon, 20 Jun 2022 04:56:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40056 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239675AbiFTI4J (ORCPT ); Mon, 20 Jun 2022 04:56:09 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A97CA627B for ; Mon, 20 Jun 2022 01:56:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1655715367; 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=QEyy/6JZbSt5hhSc4lO1WFt1fgnwbmapR64qYRXGvPc=; b=HPIKtSN1Is/swNaRBOj4kuzWqb9sHL3m/SkejYrhCptU3O08MAoSLUO0YxOfmEfHz2mxFc WUKDtN8ZGrOo5zNVw+pvM5JF54xBequCKhSLSCgf6ML4xa6rNI/rI+gbxRCWDsVArgXVIO MjxbgBwth3Qkzh0gUUQRJDk+/qtaw4w= 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-425-jSplWCh9NNmm3tSESPwIuQ-1; Mon, 20 Jun 2022 04:56:06 -0400 X-MC-Unique: jSplWCh9NNmm3tSESPwIuQ-1 Received: by mail-wm1-f70.google.com with SMTP id j31-20020a05600c1c1f00b0039c481c4664so3128819wms.7 for ; Mon, 20 Jun 2022 01:56:06 -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:subject :content-language:to:cc:references:from:organization:in-reply-to :content-transfer-encoding; bh=QEyy/6JZbSt5hhSc4lO1WFt1fgnwbmapR64qYRXGvPc=; b=Bi9095eXfx69EYLR9kHvH4NsxWGYZ/ns0TbhmhopR02IWgUtzOE6LoVcvHfbFZ5pvA f1sIxEiunUGLPB4xDyctJqmCCjkig/gAnJ1fmZ/mjoRspe57k/PQdI7+lOI84DLWtmg5 gbXsoWsMAN9KeOQWMrrMGONLdBqizHuYyN2zcGkw0ZtpTm23TejPrHC3fx+0qPoT1zV+ WcxB16tJRYYsucncAQnMXIe8W8eDqiBN+Wfl8yelEt4kzms645dAC4PelOn4V+FXGQuw 2H4YiQImPoM24x7WzMsQ4zNANf/kV0Sigv41nCZVoBCTRVgizGkvRa2P/9JzG5P23H+m ialw== X-Gm-Message-State: AOAM531DiOauwG3URwiqLH+G5pJRQPxj4J7VUWnkeSn+dAw7l4fAmXPh Jd2noTCGLxuhpCTuDaQEcUSSXvX/07WFRigivcNZQ5KvjiF/7uPHa/6fvozfzo7skMDMMU50el5 Jw7N/1zmaAILkXSE9ZcQSforl X-Received: by 2002:a05:600c:1da4:b0:39c:8ca8:5f1d with SMTP id p36-20020a05600c1da400b0039c8ca85f1dmr33538673wms.138.1655715365268; Mon, 20 Jun 2022 01:56:05 -0700 (PDT) X-Received: by 2002:a05:600c:1da4:b0:39c:8ca8:5f1d with SMTP id p36-20020a05600c1da400b0039c8ca85f1dmr33538645wms.138.1655715365042; Mon, 20 Jun 2022 01:56:05 -0700 (PDT) Received: from ?IPV6:2003:d8:2f04:2500:cdb0:9b78:d423:43f? (p200300d82f042500cdb09b78d423043f.dip0.t-ipconnect.de. [2003:d8:2f04:2500:cdb0:9b78:d423:43f]) by smtp.gmail.com with ESMTPSA id p10-20020a5d48ca000000b002102f2fac37sm12841247wrs.51.2022.06.20.01.56.04 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 20 Jun 2022 01:56:04 -0700 (PDT) Message-ID: <4be7946c-54f5-80a9-4139-5ae07a89e781@redhat.com> Date: Mon, 20 Jun 2022 10:56:03 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.0 Subject: Re: [PATCH v4 2/2] mm: memory_hotplug: make hugetlb_optimize_vmemmap compatible with memmap_on_memory Content-Language: en-US To: Oscar Salvador , Muchun Song Cc: akpm@linux-foundation.org, corbet@lwn.net, mike.kravetz@oracle.com, paulmck@kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, duanxiongchun@bytedance.com, smuchun@gmail.com References: <20220619133851.68184-1-songmuchun@bytedance.com> <20220619133851.68184-3-songmuchun@bytedance.com> <226243a9-b4f5-182e-1a5b-7b8d5c28f3b3@redhat.com> From: David Hildenbrand Organization: Red Hat In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.4 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 20.06.22 10:44, Oscar Salvador wrote: > On Mon, Jun 20, 2022 at 04:29:11PM +0800, Muchun Song wrote: >>>> Although it works, I think PageVmemmapSelfHosted() check for the 1st pfn's >>>> vmemmap page is not always reliable. Since we reused PG_owner_priv_1 >>>> as PG_vmemmap_self_hosted, the test is noly reliable for vmemmap page's >>>> vmemmap page. Other non-vmemmap page can be flagged with PG_owner_priv_1. >>>> So this check can be false-positive. Maybe the following code snippet is >>>> the solution. >>> >>> How could that happen for pages used for backing a vmemmap? >>> >> >> It cannot happen for memmap_on_memory case. Howwver, it can happen for other >> cases. E.g. the 1st pfn (of boot memory block) whose vmemmap page may be flagged >> as PG_owner_priv_1 (if PG_swapcache is set). Then, the check is false-positive. > > If this can really happen, which I am not that sure tbh, maybe a way out would be > to just define a new page-type as we did in previous versions of memmap_on_memory. > In that way we would not for flags, but for its type. > > But as I said, I am not entirely sure about the potential fallout of what you mention. We are talking about the memmap of a page, who's page content is the memmap of pages actually exposed to other users (file-backed, anonymous, whatsoever). In other words, while setting PG_swapcache on the memmap of a page exposed to the user is possible, it shouldn't be possible for the memmap of the page "hosting" these memmaps. I know, it's confusing and I keep confusing myself. I tried creating a picture and it doesn't really clarify the situation :D -- Thanks, David / dhildenb