Kernel Newbies archive on lore.kernel.org
 help / color / Atom feed
* Where is PageHead defined in v5.0?
@ 2019-03-27 22:26 Tobin C. Harding
  2019-03-28  0:34 ` Jesse Simpson
  0 siblings, 1 reply; 8+ messages in thread
From: Tobin C. Harding @ 2019-03-27 22:26 UTC (permalink / raw)
  To: kernelnewbies

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Where is PageHead defined in v5.0?
  2019-03-28  0:34 ` Jesse Simpson
@ 2019-03-27 23:49   ` Tobin C. Harding
  2019-03-28  0:23     ` Igor Pylypiv
  0 siblings, 1 reply; 8+ messages in thread
From: Tobin C. Harding @ 2019-03-27 23:49 UTC (permalink / raw)
  To: Jesse Simpson; +Cc: 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.

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Where is PageHead defined in v5.0?
  2019-03-27 23:49   ` Tobin C. Harding
@ 2019-03-28  0:23     ` Igor Pylypiv
  2019-03-28  4:43       ` Tobin C. Harding
  2019-03-28  5:50       ` Valdis Klētnieks
  0 siblings, 2 replies; 8+ messages in thread
From: Igor Pylypiv @ 2019-03-28  0:23 UTC (permalink / raw)
  To: Tobin C. Harding; +Cc: Jesse Simpson, kernelnewbies

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#L517)

__PAGEFLAG defines TESTPAGEFLAG:
        (https://elixir.bootlin.com/linux/v5.0.5/source/include/linux/page-flags.h#L248)

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#L215)

See, it is simple :)

Thanks,
Igor

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Where is PageHead defined in v5.0?
  2019-03-27 22:26 Where is PageHead defined in v5.0? Tobin C. Harding
@ 2019-03-28  0:34 ` Jesse Simpson
  2019-03-27 23:49   ` Tobin C. Harding
  0 siblings, 1 reply; 8+ messages in thread
From: Jesse Simpson @ 2019-03-28  0:34 UTC (permalink / raw)
  To: Tobin C. Harding; +Cc: kernelnewbies

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

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Where is PageHead defined in v5.0?
  2019-03-28  0:23     ` Igor Pylypiv
@ 2019-03-28  4:43       ` Tobin C. Harding
  2019-03-28  5:50       ` Valdis Klētnieks
  1 sibling, 0 replies; 8+ messages in thread
From: Tobin C. Harding @ 2019-03-28  4:43 UTC (permalink / raw)
  To: Igor Pylypiv; +Cc: Jesse Simpson, kernelnewbies

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#L517)
> 
> __PAGEFLAG defines TESTPAGEFLAG:
>         (https://elixir.bootlin.com/linux/v5.0.5/source/include/linux/page-flags.h#L248)
> 
> 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#L215)

Thanks Igor.

> See, it is simple :)

hmmm macros - no further comment needed :)


thanks
Tobin

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Where is PageHead defined in v5.0?
  2019-03-28  0:23     ` Igor Pylypiv
  2019-03-28  4:43       ` Tobin C. Harding
@ 2019-03-28  5:50       ` Valdis Klētnieks
  2019-03-28 20:49         ` Jesse Simpson
  2019-03-28 20:56         ` Tobin C. Harding
  1 sibling, 2 replies; 8+ messages in thread
From: Valdis Klētnieks @ 2019-03-28  5:50 UTC (permalink / raw)
  To: Igor Pylypiv; +Cc: kernelnewbies, Jesse Simpson, Tobin C. Harding

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#L215)

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. ;)

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Where is PageHead defined in v5.0?
  2019-03-28  5:50       ` Valdis Klētnieks
@ 2019-03-28 20:49         ` Jesse Simpson
  2019-03-28 20:56         ` Tobin C. Harding
  1 sibling, 0 replies; 8+ messages in thread
From: Jesse Simpson @ 2019-03-28 20:49 UTC (permalink / raw)
  To: Valdis Klētnieks; +Cc: Igor Pylypiv, kernelnewbies, Tobin C. Harding

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#L215)
> 
> 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



_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Where is PageHead defined in v5.0?
  2019-03-28  5:50       ` Valdis Klētnieks
  2019-03-28 20:49         ` Jesse Simpson
@ 2019-03-28 20:56         ` Tobin C. Harding
  1 sibling, 0 replies; 8+ messages in thread
From: Tobin C. Harding @ 2019-03-28 20:56 UTC (permalink / raw)
  To: Valdis Klētnieks; +Cc: Igor Pylypiv, Jesse Simpson, kernelnewbies

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#L215)
> 
> 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.

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, back to index

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-27 22:26 Where is PageHead defined in v5.0? Tobin C. Harding
2019-03-28  0:34 ` Jesse Simpson
2019-03-27 23:49   ` Tobin C. Harding
2019-03-28  0:23     ` Igor Pylypiv
2019-03-28  4:43       ` Tobin C. Harding
2019-03-28  5:50       ` Valdis Klētnieks
2019-03-28 20:49         ` Jesse Simpson
2019-03-28 20:56         ` Tobin C. Harding

Kernel Newbies archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/kernelnewbies/0 kernelnewbies/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 kernelnewbies kernelnewbies/ https://lore.kernel.org/kernelnewbies \
		kernelnewbies@kernelnewbies.org kernelnewbies@archiver.kernel.org
	public-inbox-index kernelnewbies

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernelnewbies.kernelnewbies


AGPL code for this site: git clone https://public-inbox.org/ public-inbox