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 X-Spam-Level: X-Spam-Status: No, score=-10.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,MAILING_LIST_MULTI, NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C34CBC433B4 for ; Fri, 14 May 2021 15:29:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9E237613DF for ; Fri, 14 May 2021 15:29:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231349AbhENPbJ (ORCPT ); Fri, 14 May 2021 11:31:09 -0400 Received: from mx2.suse.de ([195.135.220.15]:43534 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229932AbhENPbJ (ORCPT ); Fri, 14 May 2021 11:31:09 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id F3D57B03A; Fri, 14 May 2021 15:29:56 +0000 (UTC) Subject: Re: [PATCH v10 09/33] mm: Add folio flag manipulation functions To: "Matthew Wilcox (Oracle)" , akpm@linux-foundation.org Cc: linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Christoph Hellwig , Jeff Layton References: <20210511214735.1836149-1-willy@infradead.org> <20210511214735.1836149-10-willy@infradead.org> From: Vlastimil Babka Message-ID: Date: Fri, 14 May 2021 17:29:56 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: <20210511214735.1836149-10-willy@infradead.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org On 5/11/21 11:47 PM, Matthew Wilcox (Oracle) wrote: > These new functions are the folio analogues of the various PageFlags > functions. If CONFIG_DEBUG_VM_PGFLAGS is enabled, we check the folio > is not a tail page at every invocation. This will also catch the > PagePoisoned case as a poisoned page has every bit set, which would > include PageTail. > > This saves 1727 bytes of text with the distro-derived config that > I'm testing due to removing a double call to compound_head() in > PageSwapCache(). > > Signed-off-by: Matthew Wilcox (Oracle) > Reviewed-by: Christoph Hellwig > Acked-by: Jeff Layton Acked-by: Vlastimil Babka Some nits: ... > * Macros to create function definitions for page flags > */ > #define TESTPAGEFLAG(uname, lname, policy) \ > +static __always_inline bool folio_##lname(struct folio *folio) \ > +{ return test_bit(PG_##lname, folio_flags(folio, FOLIO_##policy)); } \ > static __always_inline int Page##uname(struct page *page) \ > { return test_bit(PG_##lname, &policy(page, 0)->flags); } Maybe unify these idents while at it? > > #define SETPAGEFLAG(uname, lname, policy) \ > +static __always_inline \ > +void folio_set_##lname##_flag(struct folio *folio) \ > +{ set_bit(PG_##lname, folio_flags(folio, FOLIO_##policy)); } \ > static __always_inline void SetPage##uname(struct page *page) \ > { set_bit(PG_##lname, &policy(page, 1)->flags); } > > #define CLEARPAGEFLAG(uname, lname, policy) \ > +static __always_inline \ > +void folio_clear_##lname##_flag(struct folio *folio) \ > +{ clear_bit(PG_##lname, folio_flags(folio, FOLIO_##policy)); } \ > static __always_inline void ClearPage##uname(struct page *page) \ > { clear_bit(PG_##lname, &policy(page, 1)->flags); } > > #define __SETPAGEFLAG(uname, lname, policy) \ > +static __always_inline \ > +void __folio_set_##lname##_flag(struct folio *folio) \ > +{ __set_bit(PG_##lname, folio_flags(folio, FOLIO_##policy)); } \ > static __always_inline void __SetPage##uname(struct page *page) \ > { __set_bit(PG_##lname, &policy(page, 1)->flags); } > > #define __CLEARPAGEFLAG(uname, lname, policy) \ > +static __always_inline \ > +void __folio_clear_##lname##_flag(struct folio *folio) \ > +{ __clear_bit(PG_##lname, folio_flags(folio, FOLIO_##policy)); } \ > static __always_inline void __ClearPage##uname(struct page *page) \ > { __clear_bit(PG_##lname, &policy(page, 1)->flags); } > > #define TESTSETFLAG(uname, lname, policy) \ > +static __always_inline \ > +bool folio_test_set_##lname##_flag(struct folio *folio) \ The line above seems to need extra tab before '\' (used vimdiff on your git tree)