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 2F3E0C7EE2C for ; Thu, 25 May 2023 08:57:22 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4QRhl44Jz8z3f7v for ; Thu, 25 May 2023 18:57:20 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=mRtUeUA+; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=kernel.org (client-ip=139.178.84.217; helo=dfw.source.kernel.org; envelope-from=rppt@kernel.org; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=mRtUeUA+; dkim-atps=neutral Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4QRhk40DFXz3bcT for ; Thu, 25 May 2023 18:56:27 +1000 (AEST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 443A86441D; Thu, 25 May 2023 08:56:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9425AC433EF; Thu, 25 May 2023 08:56:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1685004981; bh=T3x6HsAO3RQbrXA8lAmGWzhIEFxQo3e/SuF/zmio4Hs=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=mRtUeUA+TIvgOPBLeDE0LEeluR6Lkzocki1ce4LxvGW3Kh74OsnmFoUFRRmQEOqgY vPbs8UllpBsHYQNETyRPKHNQXbkjzvcZ/qcNMJMO2YSn7oQ9dFwS8Ece6KmReDjGKv UHsfvGg5kn0tsbjmZAqeTwYppOTlzTxEsz6d+ZO+0GcrxaOJ0wF3N2ge6+B4EiqPJP Rr14bkavs3kxuqVnqdy8wSuE2VMYBsI0nPEtl+gq6jIzwj54Hlj3QoMxeOG7OsIhLt Fod2UUbjMqcZpiBjbvghJGsfjbRDVycHZQ/GoUx1cUGXfXrx/0id06caAMVPKwYBaI blTpXwhMXt6qg== Date: Thu, 25 May 2023 11:55:55 +0300 From: Mike Rapoport To: "Vishal Moola (Oracle)" Subject: Re: [PATCH v2 01/34] mm: Add PAGE_TYPE_OP folio functions Message-ID: <20230525085555.GV4967@kernel.org> References: <20230501192829.17086-1-vishal.moola@gmail.com> <20230501192829.17086-2-vishal.moola@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230501192829.17086-2-vishal.moola@gmail.com> 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, 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, 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" Hi, On Mon, May 01, 2023 at 12:27:56PM -0700, Vishal Moola (Oracle) wrote: > No folio equivalents for page type operations have been defined, so > define them for later folio conversions. Can you please elaborate why would we need folios for page table descriptors? > Also changes the Page##uname macros to take in const struct page* since > we only read the memory here. > > Signed-off-by: Vishal Moola (Oracle) > --- > include/linux/page-flags.h | 20 ++++++++++++++++++-- > 1 file changed, 18 insertions(+), 2 deletions(-) > > diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h > index 1c68d67b832f..607b495d1b57 100644 > --- a/include/linux/page-flags.h > +++ b/include/linux/page-flags.h > @@ -902,6 +902,8 @@ static inline bool is_page_hwpoison(struct page *page) > > #define PageType(page, flag) \ > ((page->page_type & (PAGE_TYPE_BASE | flag)) == PAGE_TYPE_BASE) > +#define folio_test_type(folio, flag) \ > + ((folio->page.page_type & (PAGE_TYPE_BASE | flag)) == PAGE_TYPE_BASE) > > static inline int page_type_has_type(unsigned int page_type) > { > @@ -914,20 +916,34 @@ static inline int page_has_type(struct page *page) > } > > #define PAGE_TYPE_OPS(uname, lname) \ > -static __always_inline int Page##uname(struct page *page) \ > +static __always_inline int Page##uname(const struct page *page) \ > { \ > return PageType(page, PG_##lname); \ > } \ > +static __always_inline int folio_test_##lname(const struct folio *folio)\ > +{ \ > + return folio_test_type(folio, PG_##lname); \ > +} \ > static __always_inline void __SetPage##uname(struct page *page) \ > { \ > VM_BUG_ON_PAGE(!PageType(page, 0), page); \ > page->page_type &= ~PG_##lname; \ > } \ > +static __always_inline void __folio_set_##lname(struct folio *folio) \ > +{ \ > + VM_BUG_ON_FOLIO(!folio_test_type(folio, 0), folio); \ > + folio->page.page_type &= ~PG_##lname; \ > +} \ > static __always_inline void __ClearPage##uname(struct page *page) \ > { \ > VM_BUG_ON_PAGE(!Page##uname(page), page); \ > page->page_type |= PG_##lname; \ > -} > +} \ > +static __always_inline void __folio_clear_##lname(struct folio *folio) \ > +{ \ > + VM_BUG_ON_FOLIO(!folio_test_##lname(folio), folio); \ > + folio->page.page_type |= PG_##lname; \ > +} \ > > /* > * PageBuddy() indicates that the page is free and in the buddy system > -- > 2.39.2 > > -- Sincerely yours, Mike.