Question on hugepages_supported()

2 messages, 2 authors, 2017-08-02 · open the first message on its own page

Question on hugepages_supported()

From: Christophe LEROY <hidden>
Date: 2017-08-02 07:03:06

In include/linux/hugetlb.h, we find the following statement

#ifndef hugepages_supported
/*
  * Some platform decide whether they support huge pages at boot
  * time. Some of them, such as powerpc, set HPAGE_SHIFT to 0
  * when there is no such support
  */
#define hugepages_supported() (HPAGE_SHIFT != 0)
#endif

But in arch/powerpc/include/asm/page.h we find:

#ifdef CONFIG_HUGETLB_PAGE
extern unsigned int HPAGE_SHIFT;
#else
#define HPAGE_SHIFT PAGE_SHIFT
#endif


Is that correct ? SHouldn't HPAGE_SHIFT be defined to 0 when 
CONFIG_HUGETLB_PAGE is not defined ?

Christophe

Re: Question on hugepages_supported()

From: Aneesh Kumar K.V <hidden>
Date: 2017-08-02 07:29:24

Christophe LEROY [off-list ref] writes:
In include/linux/hugetlb.h, we find the following statement

#ifndef hugepages_supported
/*
  * Some platform decide whether they support huge pages at boot
  * time. Some of them, such as powerpc, set HPAGE_SHIFT to 0
  * when there is no such support
  */
#define hugepages_supported() (HPAGE_SHIFT != 0)
#endif

But in arch/powerpc/include/asm/page.h we find:

#ifdef CONFIG_HUGETLB_PAGE
extern unsigned int HPAGE_SHIFT;
#else
#define HPAGE_SHIFT PAGE_SHIFT
#endif


Is that correct ? SHouldn't HPAGE_SHIFT be defined to 0 when 
CONFIG_HUGETLB_PAGE is not defined ?
But then hugepages_supported() is only defined if HUGETLB_PAGE is
enabled. So yes we can possibly say HPAGE_SHIFT = 0 if HUGETLB is
disabled, I am not sure it has any impact with the current code ?


-aneesh
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help