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 lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (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 9FD0BEB64DC for ; Tue, 27 Jun 2023 16:10:29 +0000 (UTC) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=eDS3y/jv; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=XY59H5Hw; dkim-atps=neutral Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4Qr8nb75JCz3bXf for ; Wed, 28 Jun 2023 02:10:27 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=eDS3y/jv; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=XY59H5Hw; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=redhat.com (client-ip=170.10.133.124; helo=us-smtp-delivery-124.mimecast.com; envelope-from=peterx@redhat.com; receiver=lists.ozlabs.org) X-Greylist: delayed 88 seconds by postgrey-1.37 at boromir; Wed, 28 Jun 2023 02:09:22 AEST Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4Qr8mL62HDz2yGY for ; Wed, 28 Jun 2023 02:09:22 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687882148; 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=hJDOCrbidQ6SQFQe4MgEFJjZ7UTNPrXFah4ZUMjVF/Y=; b=eDS3y/jvGupoHcrLTzZogG7E9mRhoscPT3+AycEMHvg9malp7aIRS3DpYFHdnxH6kx2xrF avJCt3TSd9xBE3lk+Kn8KqYeNkCJeqgarybsF9ElcWgCj3eYElllccceE3YRVfRKYjXvOx UEbJWG3nMp0HVrNOrtaIdmIHCbAhL5Y= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687882152; 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=hJDOCrbidQ6SQFQe4MgEFJjZ7UTNPrXFah4ZUMjVF/Y=; b=XY59H5Hw24AN38e7xxbRvY70F39amz2/iGyYKllY9OhV5TjLEO2ceDqorE03K+zeqUvUNz K9NLcq9w4ztXcLh0B8uy2eXX+nA79qyKxN52Y5MndBlI2oq0oCUgdghb55/aqF9QTwMcAJ lw1YrYD4582C7M2mPIfbZNPwEbsrto0= Received: from mail-qk1-f197.google.com (mail-qk1-f197.google.com [209.85.222.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-408-idJfyU_aNKaSG5GP6sLdKw-1; Tue, 27 Jun 2023 12:07:46 -0400 X-MC-Unique: idJfyU_aNKaSG5GP6sLdKw-1 Received: by mail-qk1-f197.google.com with SMTP id af79cd13be357-74faf5008bbso79690385a.0 for ; Tue, 27 Jun 2023 09:07:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687882066; x=1690474066; 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=hJDOCrbidQ6SQFQe4MgEFJjZ7UTNPrXFah4ZUMjVF/Y=; b=WGgm9eSMnz9dY26rlx4L0C699tmX3aSq5liPchV0izwnjZRo9tPOPK/6sl+uXa8P57 uui3/PYHRwa4mb396CHrI2Uronsdr4GE03Oba9d1Kq3vBVzM5CsCSA8LMTVrvPtdSzdT 9bFyAZY5ytGR4lTCFuyxD54KyhFfYQuaG2Yu+UViB4s1vBmp4Igc6M+/8dlYuEwlQwgZ 5bN0h++HIwm4/82SYB0/3c6dTfH+Xd/3s5JRuA4u9/CWbGk1H94vLL+0hVyqrZOJn/Ws vEmW4/MT9sMQxjYt1Kx/aPkdHQ0WRddX33G1eQ9yUdskGgvGfzvXUXDq4zgdxxppsldK KNdw== X-Gm-Message-State: AC+VfDy34e7piRM9gfNHFINICul2nSieoYSoj6QjFthG+5CIa7+4B5lO fn+TrgzOSFt9oTfi44ToobW6rzsSbIWu2fHkIKK9XErxpSEm8FxGz7wd9RtJJ+8pKnHuCGgbv+E 3N+eVkdHsKN5eUwhV9jWGYFpyYA== X-Received: by 2002:a05:620a:4007:b0:765:7b61:46fc with SMTP id h7-20020a05620a400700b007657b6146fcmr12614182qko.7.1687882066188; Tue, 27 Jun 2023 09:07:46 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7UY1eApNq4tXkhQSQVDzyCNrRRXMA0KLJ6oWun1WyljocOJD3jbWnq1iikbRngPAZ/IFjT9Q== X-Received: by 2002:a05:620a:4007:b0:765:7b61:46fc with SMTP id h7-20020a05620a400700b007657b6146fcmr12614153qko.7.1687882065917; Tue, 27 Jun 2023 09:07:45 -0700 (PDT) Received: from x1n (cpe5c7695f3aee0-cm5c7695f3aede.cpe.net.cable.rogers.com. [99.254.144.39]) by smtp.gmail.com with ESMTPSA id m21-20020a05620a13b500b0075ecdc937ffsm1342302qki.41.2023.06.27.09.07.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Jun 2023 09:07:45 -0700 (PDT) Date: Tue, 27 Jun 2023 12:07:43 -0400 From: Peter Xu To: "Vishal Moola (Oracle)" Subject: Re: [PATCH v6 03/33] pgtable: Create struct ptdesc Message-ID: References: <20230627031431.29653-1-vishal.moola@gmail.com> <20230627031431.29653-4-vishal.moola@gmail.com> MIME-Version: 1.0 In-Reply-To: <20230627031431.29653-4-vishal.moola@gmail.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Disposition: inline X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arch@vger.kernel.org, linux-s390@vger.kernel.org, Mike Rapoport , kvm@vger.kernel.org, linux-openrisc@vger.kernel.org, linux-hexagon@vger.kernel.org, linux-sh@vger.kernel.org, linux-um@lists.infradead.org, linux-mips@vger.kernel.org, linux-csky@vger.kernel.org, linux-mm@kvack.org, linux-m68k@lists.linux-m68k.org, Hugh Dickins , Matthew Wilcox , loongarch@lists.linux.dev, sparclinux@vger.kernel.org, xen-devel@lists.xenproject.org, Andrew Morton , linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-arm-kernel@lists.infradead.org Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" On Mon, Jun 26, 2023 at 08:14:01PM -0700, Vishal Moola (Oracle) wrote: > Currently, page table information is stored within struct page. As part > of simplifying struct page, create struct ptdesc for page table > information. > > Signed-off-by: Vishal Moola (Oracle) > Acked-by: Mike Rapoport (IBM) > --- > include/linux/pgtable.h | 68 +++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 68 insertions(+) > > diff --git a/include/linux/pgtable.h b/include/linux/pgtable.h > index 5063b482e34f..d46cb709ce08 100644 > --- a/include/linux/pgtable.h > +++ b/include/linux/pgtable.h > @@ -987,6 +987,74 @@ static inline void ptep_modify_prot_commit(struct vm_area_struct *vma, > #endif /* __HAVE_ARCH_PTEP_MODIFY_PROT_TRANSACTION */ > #endif /* CONFIG_MMU */ > > + > +/** > + * struct ptdesc - Memory descriptor for page tables. > + * @__page_flags: Same as page flags. Unused for page tables. > + * @pt_rcu_head: For freeing page table pages. > + * @pt_list: List of used page tables. Used for s390 and x86. > + * @_pt_pad_1: Padding that aliases with page's compound head. > + * @pmd_huge_pte: Protected by ptdesc->ptl, used for THPs. > + * @_pt_s390_gaddr: Aliases with page's mapping. Used for s390 gmap only. Should some arch-specific bits (and a few others) always under some #ifdefs, so it shouldn't appear on other archs? > + * @pt_mm: Used for x86 pgds. > + * @pt_frag_refcount: For fragmented page table tracking. Powerpc and s390 only. > + * @ptl: Lock for the page table. > + * @__page_type: Same as page->page_type. Unused for page tables. > + * @_refcount: Same as page refcount. Used for s390 page tables. > + * @pt_memcg_data: Memcg data. Tracked for page tables here. > + * > + * This struct overlays struct page for now. Do not modify without a good > + * understanding of the issues. > + */ > +struct ptdesc { > + unsigned long __page_flags; > + > + union { > + struct rcu_head pt_rcu_head; > + struct list_head pt_list; > + struct { > + unsigned long _pt_pad_1; > + pgtable_t pmd_huge_pte; > + }; > + }; > + unsigned long _pt_s390_gaddr; > + > + union { > + struct mm_struct *pt_mm; > + atomic_t pt_frag_refcount; > + }; > + > + union { > + unsigned long _pt_pad_2; > +#if ALLOC_SPLIT_PTLOCKS > + spinlock_t *ptl; > +#else > + spinlock_t ptl; > +#endif > + }; > + unsigned int __page_type; > + atomic_t _refcount; > +#ifdef CONFIG_MEMCG > + unsigned long pt_memcg_data; > +#endif > +}; -- Peter Xu