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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0E3F5EB64DC for ; Tue, 27 Jun 2023 16:09:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232160AbjF0QJP (ORCPT ); Tue, 27 Jun 2023 12:09:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36474 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231540AbjF0QJO (ORCPT ); Tue, 27 Jun 2023 12:09:14 -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 ESMTPS id 3F8222D7C for ; Tue, 27 Jun 2023 09:07:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687882068; 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=Cc0KwX7LyXS8JYv5xGW2+kada08T3uFyGsb8yTCVnIZMX4XtJxbocE5Ojds0u20/K+87is myxitS0nc+jnkl3smPQ3i2/vDsQnyna8j92dy+nE2BauC8pcvPB3aet2VXVwCWMCIfP96f FZgTv+82jeH/NQ6orFj0L1Qu8UqSMoQ= 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-637-FTxZtKNcNEO7E7PsfA0kqw-1; Tue, 27 Jun 2023 12:07:46 -0400 X-MC-Unique: FTxZtKNcNEO7E7PsfA0kqw-1 Received: by mail-qk1-f197.google.com with SMTP id af79cd13be357-765ad67e690so36465785a.1 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=H/nMB+BhPeGUg6B5HnmwtMe7aQOA2wh/6aZnGVhide0pLpIDq8j368d/LlcCp8IyBP s1/LwH4ojLwbVNkYHjTXZ0+1kDFsS5mjAswk2QQYB2BCJkgAhUzJu8rqR4WIPI3xq11J ZDy5MwaOaCnB13ejPyi0CB8eC7Df8KbZVcA5SaENg9VsFKKeTynKB4VOICzBRvSMo1zi rCHT+hXY2KhQhUFBk+jpCQBLx2esuBMfrz4whdlFz2f7O86ZaPWmztcD5mS8bOj40wlK PVOuyxZClO2q+UWc7+wqXQ/Wg2xbLoLEg3WhPAN/0JXWGVsjb78AryWJvKnQxyqe1xXc GFWw== X-Gm-Message-State: AC+VfDw9td5hynZsbKhPYHdER8dGLC+chxiWs8MZmEW3bWOfHJGZIa8n uD344sBHjQ+Q6uoVpqUIggF0+edJljbp1bhVuRWxHuwvNw0sZlE+m/RNx5Xieu2hciJX1O5OKcI +d2lFVMwqc9VaaKafoAxJaQ== X-Received: by 2002:a05:620a:4007:b0:765:7b61:46fc with SMTP id h7-20020a05620a400700b007657b6146fcmr12614172qko.7.1687882066183; 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)" Cc: Andrew Morton , Matthew Wilcox , linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, Hugh Dickins , Mike Rapoport 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 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20230627031431.29653-4-vishal.moola@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-arch@vger.kernel.org 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