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 CFFB9ECAAA1 for ; Mon, 5 Sep 2022 08:37:58 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 626706B00FA; Mon, 5 Sep 2022 04:37:58 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5AFAD8D005A; Mon, 5 Sep 2022 04:37:58 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 44FB78D0050; Mon, 5 Sep 2022 04:37:58 -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 2FAC76B00FA for ; Mon, 5 Sep 2022 04:37:58 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id F1FE6C05B0 for ; Mon, 5 Sep 2022 08:37:57 +0000 (UTC) X-FDA: 79877378994.03.D6C6455 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf19.hostedemail.com (Postfix) with ESMTP id 1C6CD1A0051 for ; Mon, 5 Sep 2022 08:37:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1662367075; 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=RskN8vPxcZR9tBlMGRowc28Et8faIlvMz95rfc0y61A=; b=E+koqLhyDExU5CjAOlZI6p/vug+CW+eZ/u7CykDl9oyjYiHw7XZA9NuN0De7GzzR3owlQD 3clBioXXWbJ+/g4Ko+/AgshzOTc5Uw/t0PfxMeCpXFUIJ+M3X2mud7TbzPDiJL5B8NweaB ByJzjZNhEy41/qT1A/RDZ5S+fxv3h9s= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-41-7EwH-QVUPWyr80NTrdLcTg-1; Mon, 05 Sep 2022 04:37:45 -0400 X-MC-Unique: 7EwH-QVUPWyr80NTrdLcTg-1 Received: by mail-wm1-f69.google.com with SMTP id j3-20020a05600c1c0300b003a5e72421c2so5972078wms.1 for ; Mon, 05 Sep 2022 01:37:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:organization:from:references :cc:to:content-language:subject:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date; bh=RskN8vPxcZR9tBlMGRowc28Et8faIlvMz95rfc0y61A=; b=felrlRGc3I3FNuPkgd6KnakbKV9bo7UBmKh1i5tRcgMnXdeRzc+PVnIzSEPb/rGCks QykYTq82od5UF8P1YzRJwG+F3D+EFgXow/ZPtQ+21nwWxKovYrcD0wa1na2Re794sPec Qr/SKjhdVKxwQdkaLB8m1t6nde0gR02TinVz9Iq7EETGJz6yB1bfokmX8San90+MS3zi hkKQn3p4T11BduN+Sbg0nBt3r6ojo8GMT+mzi+XKUfmUPWOp1QOmye4vuEdESlk/NmfQ gbJtqt6fdoStbGXQtDTWmcThRDFs4OZjPnl3Fxte2HCQl1yaQRXoCvds8APpd7Q7pT0K ktvQ== X-Gm-Message-State: ACgBeo19jSis7l+4GzDqqqmF3BE+pe3DFHm39Kq6PW82VsmcDUqt5DKO hNgc4SOha7E8PyXGKRKHX1rWCluo2ciKqZGCiyVQFdeOGZ1Tjvbw+RWTf1T5RasEm3xu2HnbtTs pMlx3BJoRXfo= X-Received: by 2002:a05:600c:4148:b0:3a5:4f94:577b with SMTP id h8-20020a05600c414800b003a54f94577bmr10251113wmm.167.1662367063949; Mon, 05 Sep 2022 01:37:43 -0700 (PDT) X-Google-Smtp-Source: AA6agR6hOewj1kAW5ksLrjog3tDXN8mruAU1BTTIBPUwXHo5nCkedd3cF0KNcRs+6mz3jaCdK4MqQA== X-Received: by 2002:a05:600c:4148:b0:3a5:4f94:577b with SMTP id h8-20020a05600c414800b003a54f94577bmr10251102wmm.167.1662367063706; Mon, 05 Sep 2022 01:37:43 -0700 (PDT) Received: from ?IPV6:2003:d8:2f0d:ba00:c951:31d7:b2b0:8ba0? (p200300d82f0dba00c95131d7b2b08ba0.dip0.t-ipconnect.de. [2003:d8:2f0d:ba00:c951:31d7:b2b0:8ba0]) by smtp.gmail.com with ESMTPSA id n22-20020a05600c465600b003a839b9ba0asm15604972wmo.40.2022.09.05.01.37.42 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 05 Sep 2022 01:37:43 -0700 (PDT) Message-ID: <5f6a7c6b-5073-f050-8dae-6ee279a8bb0b@redhat.com> Date: Mon, 5 Sep 2022 10:37:42 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.0 Subject: Re: [PATCH] hugetlb: simplify hugetlb handling in follow_page_mask To: Christophe Leroy , Mike Kravetz Cc: "linux-mm@kvack.org" , "linux-kernel@vger.kernel.org" , "linux-ia64@vger.kernel.org" , Baolin Wang , "Aneesh Kumar K . V" , Naoya Horiguchi , Michael Ellerman , Muchun Song , Andrew Morton , "linuxppc-dev@lists.ozlabs.org" References: <20220829234053.159158-1-mike.kravetz@oracle.com> <608934d4-466d-975e-6458-34a91ccb4669@redhat.com> <739dc825-ece3-a59f-adc5-65861676e0ae@redhat.com> <323fdb0f-c5a5-e0e5-1ff4-ab971bc295cc@redhat.com> From: David Hildenbrand Organization: Red Hat In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=E+koqLhy; spf=pass (imf19.hostedemail.com: domain of david@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=david@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1662367076; a=rsa-sha256; cv=none; b=LAu38BeGLXfE3S4rQpzDfQ5eLieW6qfZlxeDJEj4Q1wOxgfjdNXIoiGpP5oQkQxLcnFBct pr83SXQrkniRPrJAd9IhFw5dZXk89hM7ePxSszROI7gNNDtrFGLq6yp/Y2+0MHn2sN5akP txpum+y1vLONj3la37vhtVgagqHRZjg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1662367076; h=from:from:sender: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:dkim-signature; bh=RskN8vPxcZR9tBlMGRowc28Et8faIlvMz95rfc0y61A=; b=KRxZ9ENrzA+RKFXrJwMV4RLMQNVLciW8xlYy4I+f9zI6GsLFNFBPY4U5qTPUKQvt9tSeib A7p95seHWrLaj1sEfyZ/tq55WYPgtuPBLrTQ8FXKC48WZF9Bw8E3MbLiZfsYmvIalVodik 3QbS5eD+VUI+jOKiy3oZhQesGuzWosY= Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=E+koqLhy; spf=pass (imf19.hostedemail.com: domain of david@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=david@redhat.com; dmarc=pass (policy=none) header.from=redhat.com X-Rspam-User: X-Stat-Signature: 3js4i674dgyaqpqhm1cbn8p56x3uom35 X-Rspamd-Queue-Id: 1C6CD1A0051 X-Rspamd-Server: rspam05 X-HE-Tag: 1662367075-923516 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 03.09.22 09:07, Christophe Leroy wrote: > +Resending with valid powerpc list address > > Le 02/09/2022 à 20:52, David Hildenbrand a écrit : >>>>> Adding Christophe on Cc: >>>>> >>>>> Christophe do you know if is_hugepd is true for all hugetlb entries, not >>>>> just hugepd? > > is_hugepd() is true if and only if the directory entry points to a huge > page directory and not to the normal lower level directory. > > As far as I understand if the directory entry is not pointing to any > lower directory but is a huge page entry, pXd_leaf() is true. > > >>>>> >>>>> On systems without hugepd entries, I guess ptdump skips all hugetlb entries. >>>>> Sigh! > > As far as I can see, ptdump_pXd_entry() handles the pXd_leaf() case. > >>>> >>>> IIUC, the idea of ptdump_walk_pgd() is to dump page tables even outside >>>> VMAs (for debugging purposes?). >>>> >>>> I cannot convince myself that that's a good idea when only holding the >>>> mmap lock in read mode, because we can just see page tables getting >>>> freed concurrently e.g., during concurrent munmap() ... while holding >>>> the mmap lock in read we may only walk inside VMA boundaries. >>>> >>>> That then raises the questions if we're only calling this on special MMs >>>> (e.g., init_mm) whereby we cannot really see concurrent munmap() and >>>> where we shouldn't have hugetlb mappings or hugepd entries. > > At least on powerpc, PTDUMP handles only init_mm. > > Hugepage are used at least on powerpc 8xx for linear memory mapping, see > > commit 34536d780683 ("powerpc/8xx: Add a function to early map kernel > via huge pages") > commit cf209951fa7f ("powerpc/8xx: Map linear memory with huge pages") > > hugepds may also be used in the future to use huge pages for vmap and > vmalloc, see commit a6a8f7c4aa7e ("powerpc/8xx: add support for huge > pages on VMAP and VMALLOC") > > As far as I know, ppc64 also use huge pages for VMAP and VMALLOC, see > > commit d909f9109c30 ("powerpc/64s/radix: Enable HAVE_ARCH_HUGE_VMAP") > commit 8abddd968a30 ("powerpc/64s/radix: Enable huge vmalloc mappings") There is a difference between an ordinary huge mapping (e.g., as used for THP) and a a hugetlb mapping. Our current understanding is that hugepd only applies to hugetlb. Wouldn't vmap/vmalloc user ordinary huge pmd entries instead of hugepd? -- Thanks, David / dhildenb