From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756572AbbIVI4W (ORCPT ); Tue, 22 Sep 2015 04:56:22 -0400 Received: from mail-pa0-f51.google.com ([209.85.220.51]:35789 "EHLO mail-pa0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750774AbbIVI4T (ORCPT ); Tue, 22 Sep 2015 04:56:19 -0400 Date: Tue, 22 Sep 2015 14:26:08 +0530 From: Sudip Mukherjee To: Andrew Morton Cc: Haavard Skinnemoen , Hans-Christian Egtvedt , Felipe Balbi , Greg Kroah-Hartman , linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, "Kirill A. Shutemov" Subject: Re: [PATCH 3/3] page-flags: rectify forward declaration Message-ID: <20150922085534.GA4122@sudip-pc> References: <1442682779-20077-1-git-send-email-sudipm.mukherjee@gmail.com> <1442682779-20077-4-git-send-email-sudipm.mukherjee@gmail.com> <20150921153509.fef7ecdf313ef74307c43b65@linux-foundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150921153509.fef7ecdf313ef74307c43b65@linux-foundation.org> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Sep 21, 2015 at 03:35:09PM -0700, Andrew Morton wrote: > On Sat, 19 Sep 2015 22:42:59 +0530 Sudip Mukherjee wrote: > > > Is it fixable? Can we use the traditional define-before-using structure? How about this: diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h index ab1a0e9..d7a1055 100644 --- a/include/linux/page-flags.h +++ b/include/linux/page-flags.h @@ -133,6 +133,19 @@ enum pageflags { #ifndef __GENERATING_BOUNDS_H +/* Forward declarations */ +struct page; +static inline int PageCompound(struct page *page); +static inline int PageTail(struct page *page); +static inline struct page *compound_head(struct page *page) +{ + unsigned long head = READ_ONCE(page->compound_head); + + if (unlikely(head & 1)) + return (struct page *) (head - 1); + return page; +} + /* Page flags policies wrt compound pages */ #define PF_ANY(page, enforce) page #define PF_HEAD(page, enforce) compound_head(page) @@ -223,12 +236,6 @@ static inline int __TestClearPage##uname(struct page *page) { return 0; } #define TESTSCFLAG_FALSE(uname) \ TESTSETFLAG_FALSE(uname) TESTCLEARFLAG_FALSE(uname) -/* Forward declarations */ -struct page; -static inline int PageCompound(struct page *page); -static inline int PageTail(struct page *page); -static struct page *compound_head(struct page *page); - __PAGEFLAG(Locked, locked, PF_NO_TAIL) PAGEFLAG(Error, error, PF_NO_COMPOUND) TESTCLEARFLAG(Error, error, PF_NO_COMPOUND) PAGEFLAG(Referenced, referenced, PF_HEAD) @@ -450,15 +457,6 @@ static inline void clear_compound_head(struct page *page) WRITE_ONCE(page->compound_head, 0); } -static inline struct page *compound_head(struct page *page) -{ - unsigned long head = READ_ONCE(page->compound_head); - - if (unlikely(head & 1)) - return (struct page *) (head - 1); - return page; -} - static inline int PageCompound(struct page *page) { return PageHead(page) || PageTail(page); --- It builds properly. Tested with allmodconfig of x86_64 and avr32. > > Also, I'm finding that the patch series introduces a pretty large > bisection hole: > > include/linux/page-flags.h: In function 'PageYoung': > include/linux/page-flags.h:327: error: implicit declaration of function 'PF_ANY' > include/linux/page-flags.h:327: error: invalid type argument of '->' (have 'int') > include/linux/page-flags.h:327: error: invalid type argument of '->' (have 'int') > > which later gets fixed up by > page-flags-rectify-forward-declaration.patch. How to test this? Should I apply them on top of v4.2 and bisect? And I don't see any relation between the first two patches and this patch of the series, then how does it fail in bisect? Am I missing something? Confused.. :( > > Maybe it's time to do a wholesale refactoring of the patchset? If this patch is the first in the series will that help? And besides I got the auto mail from you that the patch is applied. Now totally confused.. :( regards sudip