Where is PageHead defined in v5.0?
Hi, I cannot locate the definition of PageHead? It seems to have disappeared after v4.0? I can see it defined as a function here: https://elixir.bootlin.com/linux/v4.0/source/include/linux/page-flags.h#L401 But on the mainline (v5.1-rc2) I get: $ git grep ' PageHead' include/linux/page-flags.h:int PageHeadHuge(struct page *page); include/linux/page-flags.h: return PageHead(page); include/linux/page-flags.h: return PageHead(page) && test_bit(PG_double_map, &page[1].flags); mm/hugetlb.c: return PageHead(page) && PagePrivate(&page[1]); mm/hugetlb.c: * PageHeadHuge() only returns true for hugetlbfs head page, but not for mm/hugetlb.c:int PageHeadHuge(struct page *page_head) Clearly it is defined _somewhere_. Anyone any idea what brain dysfunction I am having right now? thanks, Tobin.
Hi Tobin, I took a look on my system, and I wasn't able to find where PageHead is defined either. I used grep to search for it as well as vim with ctags. Maybe it's hidden away in some built-in.a or binary file. I'm looking on version 5.0.0. Good luck, Jesse Simpson On Thu, Mar 28, 2019 at 09:26:15AM +1100, Tobin C. Harding wrote:
Hi,
I cannot locate the definition of PageHead? It seems to have disappeared after v4.0? I can see it defined as a function here:
https://elixir.bootlin.com/linux/v4.0/source/include/linux/page-flags.h#L401
But on the mainline (v5.1-rc2) I get:
$ git grep ' PageHead' include/linux/page-flags.h:int PageHeadHuge(struct page *page); include/linux/page-flags.h: return PageHead(page); include/linux/page-flags.h: return PageHead(page) && test_bit(PG_double_map, &page[1].flags); mm/hugetlb.c: return PageHead(page) && PagePrivate(&page[1]); mm/hugetlb.c: * PageHeadHuge() only returns true for hugetlbfs head page, but not for mm/hugetlb.c:int PageHeadHuge(struct page *page_head)
Clearly it is defined _somewhere_. Anyone any idea what brain dysfunction I am having right now?
thanks, Tobin.
_______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
On Wed, Mar 27, 2019 at 07:34:58PM -0500, Jesse Simpson wrote:
Hi Tobin,
I took a look on my system, and I wasn't able to find where PageHead is defined either. I used grep to search for it as well as vim with ctags. Maybe it's hidden away in some built-in.a or binary file.
Cheers Jesse, confirmation that I've not gone mad - that's a win. I'll repost this to mm-linux tomorrow if no one on here knows. thanks, Tobin.
On Wed, Mar 27, 2019 at 4:51 PM Tobin C. Harding <me@tobin.cc> wrote:
On Wed, Mar 27, 2019 at 07:34:58PM -0500, Jesse Simpson wrote:
Hi Tobin,
I took a look on my system, and I wasn't able to find where PageHead is defined either. I used grep to search for it as well as vim with ctags. Maybe it's hidden away in some built-in.a or binary file.
Cheers Jesse, confirmation that I've not gone mad - that's a win.
I'll repost this to mm-linux tomorrow if no one on here knows.
thanks, Tobin.
_______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Hi Tobin and Jesse, Neither grep nor ctags are going to help you here :) PageHead is implicitly defined using macros __PAGEFLAG: __PAGEFLAG(Head, head, PF_ANY) CLEARPAGEFLAG(Head, head, PF_ANY) (https://elixir.bootlin.com/linux/v5.0.5/source/include/linux/page-flags.h#L5...) __PAGEFLAG defines TESTPAGEFLAG: (https://elixir.bootlin.com/linux/v5.0.5/source/include/linux/page-flags.h#L2...) and TESTPAGEFLAG defines PageHead: #define TESTPAGEFLAG(uname, lname, policy) \ static __always_inline int Page##uname(struct page *page) (https://elixir.bootlin.com/linux/v5.0.5/source/include/linux/page-flags.h#L2...) See, it is simple :) Thanks, Igor
On Wed, Mar 27, 2019 at 05:23:05PM -0700, Igor Pylypiv wrote:
On Wed, Mar 27, 2019 at 4:51 PM Tobin C. Harding <me@tobin.cc> wrote:
On Wed, Mar 27, 2019 at 07:34:58PM -0500, Jesse Simpson wrote:
Hi Tobin,
I took a look on my system, and I wasn't able to find where PageHead is defined either. I used grep to search for it as well as vim with ctags. Maybe it's hidden away in some built-in.a or binary file.
Cheers Jesse, confirmation that I've not gone mad - that's a win.
I'll repost this to mm-linux tomorrow if no one on here knows.
thanks, Tobin.
_______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Hi Tobin and Jesse,
Neither grep nor ctags are going to help you here :)
PageHead is implicitly defined using macros __PAGEFLAG: __PAGEFLAG(Head, head, PF_ANY) CLEARPAGEFLAG(Head, head, PF_ANY) (https://elixir.bootlin.com/linux/v5.0.5/source/include/linux/page-flags.h#L5...)
__PAGEFLAG defines TESTPAGEFLAG: (https://elixir.bootlin.com/linux/v5.0.5/source/include/linux/page-flags.h#L2...)
and TESTPAGEFLAG defines PageHead: #define TESTPAGEFLAG(uname, lname, policy) \ static __always_inline int Page##uname(struct page *page) (https://elixir.bootlin.com/linux/v5.0.5/source/include/linux/page-flags.h#L2...)
Thanks Igor.
See, it is simple :)
hmmm macros - no further comment needed :) thanks Tobin
On Wed, 27 Mar 2019 17:23:05 -0700, Igor Pylypiv said:
and TESTPAGEFLAG defines PageHead: #define TESTPAGEFLAG(uname, lname, policy) \ static __always_inline int Page##uname(struct page *page) (https://elixir.bootlin.com/linux/v5.0.5/source/include/linux/page-flags.h#L2...)
General tip: If you're trying to find where the kernel defines FooBar, and 'git grep FooBar' only finds uses and no definitions, it probably means somebody got over-exuberant with the ## pre-processor operator 'git grep Foo##' usually reveals the culprit. ;)
On Thu, Mar 28, 2019 at 01:50:47AM -0400, Valdis Klētnieks wrote:
On Wed, 27 Mar 2019 17:23:05 -0700, Igor Pylypiv said:
and TESTPAGEFLAG defines PageHead: #define TESTPAGEFLAG(uname, lname, policy) \ static __always_inline int Page##uname(struct page *page) (https://elixir.bootlin.com/linux/v5.0.5/source/include/linux/page-flags.h#L2...)
General tip: If you're trying to find where the kernel defines FooBar, and 'git grep FooBar' only finds uses and no definitions, it probably means somebody got over-exuberant with the ## pre-processor operator
'git grep Foo##' usually reveals the culprit. ;)
Thanks for the tip Valdis. I'm going to look more into the ## operator so that I can understand it's use case better. I've used macros before but this one seems a bit strange. :) Jesse Simpson
On Thu, Mar 28, 2019 at 01:50:47AM -0400, Valdis Klētnieks wrote:
On Wed, 27 Mar 2019 17:23:05 -0700, Igor Pylypiv said:
and TESTPAGEFLAG defines PageHead: #define TESTPAGEFLAG(uname, lname, policy) \ static __always_inline int Page##uname(struct page *page) (https://elixir.bootlin.com/linux/v5.0.5/source/include/linux/page-flags.h#L2...)
General tip: If you're trying to find where the kernel defines FooBar, and 'git grep FooBar' only finds uses and no definitions, it probably means somebody got over-exuberant with the ## pre-processor operator
'git grep Foo##' usually reveals the culprit. ;)
Awesome tip, thanks Valdis.
participants (4)
-
Igor Pylypiv -
Jesse Simpson -
Tobin C. Harding -
Valdis Klētnieks