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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BBB02C3DA4A for ; Fri, 9 Aug 2024 17:17:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:In-Reply-To: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=lWgHfye1k/eUTN9Ag8F85Wjlr482Lhi/qRRDj/XILyk=; b=lgWM9Izt7K5noXB+ZPhX4nLPC9 QryO01OU2SloTbzSk5J7Nmu3J1CGNk3l3WygUKeo84Y5Sv382y04NjdWYGxK0uFpHi0l1nRJUHgea h65M9T6NGmyVFPlFxm+LyKgzSIgUVZkB1LN1O+nCH2leM2yyz/kSiVOTnY2RDJHy7cvX02PRuMaUa +WQd9g4imX5iG2TEfZoBuxUmuRsHwKHhOvO9CzJ4wfifxORFVBWW330kIyKOqF9ui13d8Om+BlSEO kR3MkgJgaRu+soecUiZExAGq9o0MFk+3MrABc3NHfQbdiWkvYuIQRCrJ3BbEe7HLoBt+VEVdoB9GM YV0yV9xQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1scTF9-0000000C2jo-3o6r; Fri, 09 Aug 2024 17:17:35 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1scTEZ-0000000C2Yi-2I1N for linux-arm-kernel@lists.infradead.org; Fri, 09 Aug 2024 17:17:01 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1723223818; 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: in-reply-to:in-reply-to:references:references; bh=lWgHfye1k/eUTN9Ag8F85Wjlr482Lhi/qRRDj/XILyk=; b=fVsbLAhIrpoCfy26phVJ3Y+V9BpUj1zP3z7iB/zrPmbgYvJpm6pgMZQdJR+n1NKrJKLWAJ cwNMKqM5u4Vv7kpdhfUsYcKmFQl+3YckkBHnvcVO7Gwww2cjELZp/1kcGPe5WfYeuicwbW rx5pkGyT98+SH/CmspPPGhZ3y91ydXk= Received: from mail-qv1-f71.google.com (mail-qv1-f71.google.com [209.85.219.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-146-Ym-Ctu8nNiqvLsWnfAL9wQ-1; Fri, 09 Aug 2024 13:16:55 -0400 X-MC-Unique: Ym-Ctu8nNiqvLsWnfAL9wQ-1 Received: by mail-qv1-f71.google.com with SMTP id 6a1803df08f44-6b7a17dea12so2124976d6.2 for ; Fri, 09 Aug 2024 10:16:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723223815; x=1723828615; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=lWgHfye1k/eUTN9Ag8F85Wjlr482Lhi/qRRDj/XILyk=; b=OwVan7iCeGE8EUHCnRwAA3lCxN0+a4yloluhBdqFhawkRniKLhKIYXpFRaB5sTxT/p tjcYYpqwXLNgB1D4y0RV66BLscbDSZaYnFkQpD9zEp8pR65UUZvVDG2MAVY4WL2ngpU4 14DceMclkGbsC2EIVi0hLlTfiMHxhV9610A8rEPQNn+wSHlzinIv47MpWLHZoGx3oxYU 7iLm3HY8ouKkYho2kllYMNQwt5GsbVciRsQR7Jel6CEHLZqsDJPGlOl8Kugqg0BaS5m1 UgzboD55u+TtYqiAmskMkTCIJwi9YoWi2fbPy6NIOdkQZSrjURcKvRi8LJ3uOaQlWOH0 z8nQ== X-Forwarded-Encrypted: i=1; AJvYcCVHkMjNo0EL+GG4HJp2HfjQTtbEvKvLf2ePZ3TCKeWz6scExY4vm+Owt8ePessAKXi8XA4J95SuL5+gDAqLSWDYy0l1zMfpzuBtyPDpeQ6dzpiBvIY= X-Gm-Message-State: AOJu0YzMdlu1Vpw8rPMFtZPy0F4KmaA/u8WOy+hCo2J5JmnNi+g0UpG6 44aRKtSBWbueuB9bj2zyJkeiP52AXR+XPv38ByxTWP2/QaZ1tkZ4RpTpSk6Fy5chHVjCacBSgEy 1NfdFHVC9KzphUauGidFQ+bdP1NrtMh+jjaHEBfYgOiEF6oHAhVFzww3sQIe3JbB6MesPvx8+ X-Received: by 2002:a05:620a:1925:b0:79e:fc87:b4fe with SMTP id af79cd13be357-7a4c1780209mr131243685a.1.1723223814898; Fri, 09 Aug 2024 10:16:54 -0700 (PDT) X-Google-Smtp-Source: AGHT+IESBrnT/S4Eke81ioq4DZsO1LgixDYHAiPo//Jt33fK/EQNoj7Ue5Q/Gq+QoNJZ6zQNfyAuHg== X-Received: by 2002:a05:620a:1925:b0:79e:fc87:b4fe with SMTP id af79cd13be357-7a4c1780209mr131240785a.1.1723223814512; Fri, 09 Aug 2024 10:16:54 -0700 (PDT) Received: from x1n (pool-99-254-121-117.cpe.net.cable.rogers.com. [99.254.121.117]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7a3785d06fesm281331985a.1.2024.08.09.10.16.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Aug 2024 10:16:54 -0700 (PDT) Date: Fri, 9 Aug 2024 13:16:51 -0400 From: Peter Xu To: David Hildenbrand Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Sean Christopherson , Oscar Salvador , Jason Gunthorpe , Axel Rasmussen , linux-arm-kernel@lists.infradead.org, x86@kernel.org, Will Deacon , Gavin Shan , Paolo Bonzini , Zi Yan , Andrew Morton , Catalin Marinas , Ingo Molnar , Alistair Popple , Borislav Petkov , Thomas Gleixner , kvm@vger.kernel.org, Dave Hansen , Alex Williamson , Yan Zhao Subject: Re: [PATCH 01/19] mm: Introduce ARCH_SUPPORTS_HUGE_PFNMAP and special bits to pmd/pud Message-ID: References: <20240809160909.1023470-1-peterx@redhat.com> <20240809160909.1023470-2-peterx@redhat.com> MIME-Version: 1.0 In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Disposition: inline X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240809_101659_678061_6FA61AE1 X-CRM114-Status: GOOD ( 24.91 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, Aug 09, 2024 at 06:34:15PM +0200, David Hildenbrand wrote: > On 09.08.24 18:08, Peter Xu wrote: > > This patch introduces the option to introduce special pte bit into > > pmd/puds. Archs can start to define pmd_special / pud_special when > > supported by selecting the new option. Per-arch support will be added > > later. > > > > Before that, create fallbacks for these helpers so that they are always > > available. > > > > Signed-off-by: Peter Xu > > --- > > include/linux/mm.h | 24 ++++++++++++++++++++++++ > > mm/Kconfig | 13 +++++++++++++ > > 2 files changed, 37 insertions(+) > > > > diff --git a/include/linux/mm.h b/include/linux/mm.h > > index 43b40334e9b2..90ca84200800 100644 > > --- a/include/linux/mm.h > > +++ b/include/linux/mm.h > > @@ -2644,6 +2644,30 @@ static inline pte_t pte_mkspecial(pte_t pte) > > } > > #endif > > +#ifndef CONFIG_ARCH_SUPPORTS_PMD_PFNMAP > > +static inline bool pmd_special(pmd_t pmd) > > +{ > > + return false; > > +} > > + > > +static inline pmd_t pmd_mkspecial(pmd_t pmd) > > +{ > > + return pmd; > > +} > > +#endif /* CONFIG_ARCH_SUPPORTS_PMD_PFNMAP */ > > + > > +#ifndef CONFIG_ARCH_SUPPORTS_PUD_PFNMAP > > +static inline bool pud_special(pud_t pud) > > +{ > > + return false; > > +} > > + > > +static inline pud_t pud_mkspecial(pud_t pud) > > +{ > > + return pud; > > +} > > +#endif /* CONFIG_ARCH_SUPPORTS_PUD_PFNMAP */ > > + > > #ifndef CONFIG_ARCH_HAS_PTE_DEVMAP > > static inline int pte_devmap(pte_t pte) > > { > > diff --git a/mm/Kconfig b/mm/Kconfig > > index 3936fe4d26d9..3db0eebb53e2 100644 > > --- a/mm/Kconfig > > +++ b/mm/Kconfig > > @@ -881,6 +881,19 @@ endif # TRANSPARENT_HUGEPAGE > > config PGTABLE_HAS_HUGE_LEAVES > > def_bool TRANSPARENT_HUGEPAGE || HUGETLB_PAGE > > +# TODO: Allow to be enabled without THP > > +config ARCH_SUPPORTS_HUGE_PFNMAP > > + def_bool n > > + depends on TRANSPARENT_HUGEPAGE > > + > > +config ARCH_SUPPORTS_PMD_PFNMAP > > + def_bool y > > + depends on ARCH_SUPPORTS_HUGE_PFNMAP && HAVE_ARCH_TRANSPARENT_HUGEPAGE > > + > > +config ARCH_SUPPORTS_PUD_PFNMAP > > + def_bool y > > + depends on ARCH_SUPPORTS_HUGE_PFNMAP && HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD > > + > > # > > # UP and nommu archs use km based percpu allocator > > # > > As noted in reply to other patches, I think you have to take care of > vm_normal_page_pmd() [if not done in another patch I am missing] and likely > you want to introduce vm_normal_page_pud(). So far this patch may not have direct involvement with vm_normal_page_pud() yet? Anyway, let's keep the discussion there, then we'll know how to move on. Thanks, -- Peter Xu