linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] hugetlb: misc small fixes/improvements
@ 2014-11-12 22:33 Luiz Capitulino
  2014-11-12 22:33 ` [PATCH 1/3] hugetlb: fix hugepages= entry in kernel-parameters.txt Luiz Capitulino
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Luiz Capitulino @ 2014-11-12 22:33 UTC (permalink / raw)
  To: linux-mm
  Cc: linux-kernel, akpm, andi, rientjes, riel, isimatu.yasuaki,
	yinghai, davidlohr

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

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

* [PATCH 1/3] hugetlb: fix hugepages= entry in kernel-parameters.txt
  2014-11-12 22:33 [PATCH 0/3] hugetlb: misc small fixes/improvements Luiz Capitulino
@ 2014-11-12 22:33 ` Luiz Capitulino
  2014-11-17  0:11   ` Naoya Horiguchi
  2014-11-19 22:39   ` David Rientjes
  2014-11-12 22:33 ` [PATCH 2/3] hugetlb: alloc_bootmem_huge_page(): use IS_ALIGNED() Luiz Capitulino
  2014-11-12 22:33 ` [PATCH 3/3] hugetlb: hugetlb_register_all_nodes(): add __init marker Luiz Capitulino
  2 siblings, 2 replies; 10+ messages in thread
From: Luiz Capitulino @ 2014-11-12 22:33 UTC (permalink / raw)
  To: linux-mm
  Cc: linux-kernel, akpm, andi, rientjes, riel, isimatu.yasuaki,
	yinghai, davidlohr

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 <lcapitulino@redhat.com>
---
 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


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

* [PATCH 2/3] hugetlb: alloc_bootmem_huge_page(): use IS_ALIGNED()
  2014-11-12 22:33 [PATCH 0/3] hugetlb: misc small fixes/improvements Luiz Capitulino
  2014-11-12 22:33 ` [PATCH 1/3] hugetlb: fix hugepages= entry in kernel-parameters.txt Luiz Capitulino
@ 2014-11-12 22:33 ` Luiz Capitulino
  2014-11-17  0:11   ` Naoya Horiguchi
  2014-11-19 22:42   ` David Rientjes
  2014-11-12 22:33 ` [PATCH 3/3] hugetlb: hugetlb_register_all_nodes(): add __init marker Luiz Capitulino
  2 siblings, 2 replies; 10+ messages in thread
From: Luiz Capitulino @ 2014-11-12 22:33 UTC (permalink / raw)
  To: linux-mm
  Cc: linux-kernel, akpm, andi, rientjes, riel, isimatu.yasuaki,
	yinghai, davidlohr

No reason to duplicate the code of an existing macro.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
---
 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


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

* [PATCH 3/3] hugetlb: hugetlb_register_all_nodes(): add __init marker
  2014-11-12 22:33 [PATCH 0/3] hugetlb: misc small fixes/improvements Luiz Capitulino
  2014-11-12 22:33 ` [PATCH 1/3] hugetlb: fix hugepages= entry in kernel-parameters.txt Luiz Capitulino
  2014-11-12 22:33 ` [PATCH 2/3] hugetlb: alloc_bootmem_huge_page(): use IS_ALIGNED() Luiz Capitulino
@ 2014-11-12 22:33 ` Luiz Capitulino
  2014-11-17  0:12   ` Naoya Horiguchi
  2014-11-19 22:43   ` David Rientjes
  2 siblings, 2 replies; 10+ messages in thread
From: Luiz Capitulino @ 2014-11-12 22:33 UTC (permalink / raw)
  To: linux-mm
  Cc: linux-kernel, akpm, andi, rientjes, riel, isimatu.yasuaki,
	yinghai, davidlohr

This function is only called during initialization.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
---
 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


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

* Re: [PATCH 1/3] hugetlb: fix hugepages= entry in kernel-parameters.txt
  2014-11-12 22:33 ` [PATCH 1/3] hugetlb: fix hugepages= entry in kernel-parameters.txt Luiz Capitulino
@ 2014-11-17  0:11   ` Naoya Horiguchi
  2014-11-19 22:39   ` David Rientjes
  1 sibling, 0 replies; 10+ messages in thread
From: Naoya Horiguchi @ 2014-11-17  0:11 UTC (permalink / raw)
  To: Luiz Capitulino
  Cc: linux-mm, linux-kernel, akpm, andi, rientjes, riel,
	isimatu.yasuaki, yinghai, davidlohr

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 <lcapitulino@redhat.com>

Acked-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>

> ---
>  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 majordomo@kvack.org.  For more info on Linux MM,
> see: http://www.linux-mm.org/ .
> Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: [PATCH 2/3] hugetlb: alloc_bootmem_huge_page(): use IS_ALIGNED()
  2014-11-12 22:33 ` [PATCH 2/3] hugetlb: alloc_bootmem_huge_page(): use IS_ALIGNED() Luiz Capitulino
@ 2014-11-17  0:11   ` Naoya Horiguchi
  2014-11-19 22:42   ` David Rientjes
  1 sibling, 0 replies; 10+ messages in thread
From: Naoya Horiguchi @ 2014-11-17  0:11 UTC (permalink / raw)
  To: Luiz Capitulino
  Cc: linux-mm, linux-kernel, akpm, andi, rientjes, riel,
	isimatu.yasuaki, yinghai, davidlohr

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 <lcapitulino@redhat.com>

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 <n-horiguchi@ah.jp.nec.com>

> ---
>  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 majordomo@kvack.org.  For more info on Linux MM,
> see: http://www.linux-mm.org/ .
> Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: [PATCH 3/3] hugetlb: hugetlb_register_all_nodes(): add __init marker
  2014-11-12 22:33 ` [PATCH 3/3] hugetlb: hugetlb_register_all_nodes(): add __init marker Luiz Capitulino
@ 2014-11-17  0:12   ` Naoya Horiguchi
  2014-11-19 22:43   ` David Rientjes
  1 sibling, 0 replies; 10+ messages in thread
From: Naoya Horiguchi @ 2014-11-17  0:12 UTC (permalink / raw)
  To: Luiz Capitulino
  Cc: linux-mm, linux-kernel, akpm, andi, rientjes, riel,
	isimatu.yasuaki, yinghai, davidlohr

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 <lcapitulino@redhat.com>

Acked-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>

> ---
>  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 majordomo@kvack.org.  For more info on Linux MM,
> see: http://www.linux-mm.org/ .
> Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: [PATCH 1/3] hugetlb: fix hugepages= entry in kernel-parameters.txt
  2014-11-12 22:33 ` [PATCH 1/3] hugetlb: fix hugepages= entry in kernel-parameters.txt Luiz Capitulino
  2014-11-17  0:11   ` Naoya Horiguchi
@ 2014-11-19 22:39   ` David Rientjes
  1 sibling, 0 replies; 10+ messages in thread
From: David Rientjes @ 2014-11-19 22:39 UTC (permalink / raw)
  To: Luiz Capitulino
  Cc: linux-mm, linux-kernel, akpm, andi, riel, isimatu.yasuaki,
	yinghai, davidlohr

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 <lcapitulino@redhat.com>

Acked-by: David Rientjes <rientjes@google.com>

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

* Re: [PATCH 2/3] hugetlb: alloc_bootmem_huge_page(): use IS_ALIGNED()
  2014-11-12 22:33 ` [PATCH 2/3] hugetlb: alloc_bootmem_huge_page(): use IS_ALIGNED() Luiz Capitulino
  2014-11-17  0:11   ` Naoya Horiguchi
@ 2014-11-19 22:42   ` David Rientjes
  1 sibling, 0 replies; 10+ messages in thread
From: David Rientjes @ 2014-11-19 22:42 UTC (permalink / raw)
  To: Luiz Capitulino
  Cc: linux-mm, linux-kernel, akpm, andi, riel, isimatu.yasuaki,
	yinghai, davidlohr

On Wed, 12 Nov 2014, Luiz Capitulino wrote:

> No reason to duplicate the code of an existing macro.
> 
> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>

Acked-by: David Rientjes <rientjes@google.com>

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

* Re: [PATCH 3/3] hugetlb: hugetlb_register_all_nodes(): add __init marker
  2014-11-12 22:33 ` [PATCH 3/3] hugetlb: hugetlb_register_all_nodes(): add __init marker Luiz Capitulino
  2014-11-17  0:12   ` Naoya Horiguchi
@ 2014-11-19 22:43   ` David Rientjes
  1 sibling, 0 replies; 10+ messages in thread
From: David Rientjes @ 2014-11-19 22:43 UTC (permalink / raw)
  To: Luiz Capitulino
  Cc: linux-mm, linux-kernel, akpm, andi, riel, isimatu.yasuaki,
	yinghai, davidlohr

On Wed, 12 Nov 2014, Luiz Capitulino wrote:

> This function is only called during initialization.
> 
> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>

Acked-by: David Rientjes <rientjes@google.com>

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

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

end of thread, other threads:[~2014-11-19 22:43 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-12 22:33 [PATCH 0/3] hugetlb: misc small fixes/improvements Luiz Capitulino
2014-11-12 22:33 ` [PATCH 1/3] hugetlb: fix hugepages= entry in kernel-parameters.txt Luiz Capitulino
2014-11-17  0:11   ` Naoya Horiguchi
2014-11-19 22:39   ` David Rientjes
2014-11-12 22:33 ` [PATCH 2/3] hugetlb: alloc_bootmem_huge_page(): use IS_ALIGNED() Luiz Capitulino
2014-11-17  0:11   ` Naoya Horiguchi
2014-11-19 22:42   ` David Rientjes
2014-11-12 22:33 ` [PATCH 3/3] hugetlb: hugetlb_register_all_nodes(): add __init marker Luiz Capitulino
2014-11-17  0:12   ` Naoya Horiguchi
2014-11-19 22:43   ` David Rientjes

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).