2014-11-12 22:33:47

by Luiz Capitulino

[permalink] [raw]
Subject: [PATCH 0/3] hugetlb: misc small fixes/improvements

Hi,

This series contains three independent patches for hugetlb. The first one
is a doc fix, the second and third ones are little code improvements.

Please, check individual patches for details.

Luiz Capitulino (3):
hugetlb: fix hugepages= entry in kernel-parameters.txt
hugetlb: alloc_bootmem_huge_page(): use IS_ALIGNED()
hugetlb: hugetlb_register_all_nodes(): add __init marker

Documentation/kernel-parameters.txt | 4 +---
mm/hugetlb.c | 4 ++--
2 files changed, 3 insertions(+), 5 deletions(-)

--
1.9.3


2014-11-12 22:33:49

by Luiz Capitulino

[permalink] [raw]
Subject: [PATCH 2/3] hugetlb: alloc_bootmem_huge_page(): use IS_ALIGNED()

No reason to duplicate the code of an existing macro.

Signed-off-by: Luiz Capitulino <[email protected]>
---
mm/hugetlb.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 9fd7227..a10fd57 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -1457,7 +1457,7 @@ int __weak alloc_bootmem_huge_page(struct hstate *h)
return 0;

found:
- BUG_ON((unsigned long)virt_to_phys(m) & (huge_page_size(h) - 1));
+ BUG_ON(!IS_ALIGNED(virt_to_phys(m), huge_page_size(h)));
/* Put them into a private list first because mem_map is not up yet */
list_add(&m->list, &huge_boot_pages);
m->hstate = h;
--
1.9.3

2014-11-12 22:33:54

by Luiz Capitulino

[permalink] [raw]
Subject: [PATCH 3/3] hugetlb: hugetlb_register_all_nodes(): add __init marker

This function is only called during initialization.

Signed-off-by: Luiz Capitulino <[email protected]>
---
mm/hugetlb.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index a10fd57..9785546 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -2083,7 +2083,7 @@ static void hugetlb_register_node(struct node *node)
* devices of nodes that have memory. All on-line nodes should have
* registered their associated device by this time.
*/
-static void hugetlb_register_all_nodes(void)
+static void __init hugetlb_register_all_nodes(void)
{
int nid;

--
1.9.3

2014-11-12 22:33:46

by Luiz Capitulino

[permalink] [raw]
Subject: [PATCH 1/3] hugetlb: fix hugepages= entry in kernel-parameters.txt

The hugepages= entry in kernel-parameters.txt states that
1GB pages can only be allocated at boot time and not
freed afterwards. This is not true since commit
944d9fec8d7aee, at least for x86_64.

Instead of adding arch-specifc observations to the
hugepages= entry, this commit just drops the out of date
information. Further information about arch-specific
support and available features can be obtained in the
hugetlb documentation.

Signed-off-by: Luiz Capitulino <[email protected]>
---
Documentation/kernel-parameters.txt | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index 479f332..d919af0 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -1228,9 +1228,7 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
multiple times interleaved with hugepages= to reserve
huge pages of different sizes. Valid pages sizes on
x86-64 are 2M (when the CPU supports "pse") and 1G
- (when the CPU supports the "pdpe1gb" cpuinfo flag)
- Note that 1GB pages can only be allocated at boot time
- using hugepages= and not freed afterwards.
+ (when the CPU supports the "pdpe1gb" cpuinfo flag).

hvc_iucv= [S390] Number of z/VM IUCV hypervisor console (HVC)
terminal devices. Valid values: 0..8
--
1.9.3

2014-11-17 00:15:43

by Naoya Horiguchi

[permalink] [raw]
Subject: Re: [PATCH 1/3] hugetlb: fix hugepages= entry in kernel-parameters.txt

On Wed, Nov 12, 2014 at 05:33:11PM -0500, Luiz Capitulino wrote:
> The hugepages= entry in kernel-parameters.txt states that
> 1GB pages can only be allocated at boot time and not
> freed afterwards. This is not true since commit
> 944d9fec8d7aee, at least for x86_64.
>
> Instead of adding arch-specifc observations to the
> hugepages= entry, this commit just drops the out of date
> information. Further information about arch-specific
> support and available features can be obtained in the
> hugetlb documentation.
>
> Signed-off-by: Luiz Capitulino <[email protected]>

Acked-by: Naoya Horiguchi <[email protected]>

> ---
> Documentation/kernel-parameters.txt | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
> index 479f332..d919af0 100644
> --- a/Documentation/kernel-parameters.txt
> +++ b/Documentation/kernel-parameters.txt
> @@ -1228,9 +1228,7 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
> multiple times interleaved with hugepages= to reserve
> huge pages of different sizes. Valid pages sizes on
> x86-64 are 2M (when the CPU supports "pse") and 1G
> - (when the CPU supports the "pdpe1gb" cpuinfo flag)
> - Note that 1GB pages can only be allocated at boot time
> - using hugepages= and not freed afterwards.
> + (when the CPU supports the "pdpe1gb" cpuinfo flag).
>
> hvc_iucv= [S390] Number of z/VM IUCV hypervisor console (HVC)
> terminal devices. Valid values: 0..8
> --
> 1.9.3
>
> --
> To unsubscribe, send a message with 'unsubscribe linux-mm' in
> the body to [email protected]. For more info on Linux MM,
> see: http://www.linux-mm.org/ .
> Don't email: <a href=mailto:"[email protected]"> [email protected] </a>-

2014-11-17 00:16:19

by Naoya Horiguchi

[permalink] [raw]
Subject: Re: [PATCH 2/3] hugetlb: alloc_bootmem_huge_page(): use IS_ALIGNED()

On Wed, Nov 12, 2014 at 05:33:12PM -0500, Luiz Capitulino wrote:
> No reason to duplicate the code of an existing macro.
>
> Signed-off-by: Luiz Capitulino <[email protected]>

I think that we can apply the same macro for the following two lines in
__unmap_hugepage_range():

BUG_ON(start & ~huge_page_mask(h));
BUG_ON(end & ~huge_page_mask(h));

Anyway, this makes the code more readable.

Acked-by: Naoya Horiguchi <[email protected]>

> ---
> mm/hugetlb.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/mm/hugetlb.c b/mm/hugetlb.c
> index 9fd7227..a10fd57 100644
> --- a/mm/hugetlb.c
> +++ b/mm/hugetlb.c
> @@ -1457,7 +1457,7 @@ int __weak alloc_bootmem_huge_page(struct hstate *h)
> return 0;
>
> found:
> - BUG_ON((unsigned long)virt_to_phys(m) & (huge_page_size(h) - 1));
> + BUG_ON(!IS_ALIGNED(virt_to_phys(m), huge_page_size(h)));
> /* Put them into a private list first because mem_map is not up yet */
> list_add(&m->list, &huge_boot_pages);
> m->hstate = h;
> --
> 1.9.3
>
> --
> To unsubscribe, send a message with 'unsubscribe linux-mm' in
> the body to [email protected]. For more info on Linux MM,
> see: http://www.linux-mm.org/ .
> Don't email: <a href=mailto:"[email protected]"> [email protected] </a>-

2014-11-17 00:16:23

by Naoya Horiguchi

[permalink] [raw]
Subject: Re: [PATCH 3/3] hugetlb: hugetlb_register_all_nodes(): add __init marker

On Wed, Nov 12, 2014 at 05:33:13PM -0500, Luiz Capitulino wrote:
> This function is only called during initialization.
>
> Signed-off-by: Luiz Capitulino <[email protected]>

Acked-by: Naoya Horiguchi <[email protected]>

> ---
> mm/hugetlb.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/mm/hugetlb.c b/mm/hugetlb.c
> index a10fd57..9785546 100644
> --- a/mm/hugetlb.c
> +++ b/mm/hugetlb.c
> @@ -2083,7 +2083,7 @@ static void hugetlb_register_node(struct node *node)
> * devices of nodes that have memory. All on-line nodes should have
> * registered their associated device by this time.
> */
> -static void hugetlb_register_all_nodes(void)
> +static void __init hugetlb_register_all_nodes(void)
> {
> int nid;
>
> --
> 1.9.3
>
> --
> To unsubscribe, send a message with 'unsubscribe linux-mm' in
> the body to [email protected]. For more info on Linux MM,
> see: http://www.linux-mm.org/ .
> Don't email: <a href=mailto:"[email protected]"> [email protected] </a>-

2014-11-19 22:39:32

by David Rientjes

[permalink] [raw]
Subject: Re: [PATCH 1/3] hugetlb: fix hugepages= entry in kernel-parameters.txt

On Wed, 12 Nov 2014, Luiz Capitulino wrote:

> The hugepages= entry in kernel-parameters.txt states that
> 1GB pages can only be allocated at boot time and not
> freed afterwards. This is not true since commit
> 944d9fec8d7aee, at least for x86_64.
>
> Instead of adding arch-specifc observations to the
> hugepages= entry, this commit just drops the out of date
> information. Further information about arch-specific
> support and available features can be obtained in the
> hugetlb documentation.
>
> Signed-off-by: Luiz Capitulino <[email protected]>

Acked-by: David Rientjes <[email protected]>

2014-11-19 22:42:06

by David Rientjes

[permalink] [raw]
Subject: Re: [PATCH 2/3] hugetlb: alloc_bootmem_huge_page(): use IS_ALIGNED()

On Wed, 12 Nov 2014, Luiz Capitulino wrote:

> No reason to duplicate the code of an existing macro.
>
> Signed-off-by: Luiz Capitulino <[email protected]>

Acked-by: David Rientjes <[email protected]>

2014-11-19 22:43:43

by David Rientjes

[permalink] [raw]
Subject: Re: [PATCH 3/3] hugetlb: hugetlb_register_all_nodes(): add __init marker

On Wed, 12 Nov 2014, Luiz Capitulino wrote:

> This function is only called during initialization.
>
> Signed-off-by: Luiz Capitulino <[email protected]>

Acked-by: David Rientjes <[email protected]>

And hugetlb_unregister_all_nodes() could be __exit. The !CONFIG_NUMA
versions would be better off inline.