* [PATCH] mm: hugetlb: fix type of delta parameter in gather_surplus_pages()
@ 2020-11-18 13:14 Liu Xiang
2020-11-18 18:41 ` Mike Kravetz
0 siblings, 1 reply; 3+ messages in thread
From: Liu Xiang @ 2020-11-18 13:14 UTC (permalink / raw)
To: linux-mm
Cc: mike.kravetz, akpm, linux-kernel, liuxiang_1999, Liu Xiang, Pan Jiagen
On 64-bit machine, delta variable in hugetlb_acct_memory() may be larger
than 0xffffffff, but gather_surplus_pages() can only use the low 32-bit
value now.
Reported-by: Ma Chenggong <ma.chenggong@zlingsmart.com>
Signed-off-by: Liu Xiang <liu.xiang@zlingsmart.com>
Signed-off-by: Pan Jiagen <pan.jiagen@zlingsmart.com>
---
mm/hugetlb.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 37f15c3..293b36d 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -1943,7 +1943,7 @@ struct page *alloc_huge_page_vma(struct hstate *h, struct vm_area_struct *vma,
* Increase the hugetlb pool such that it can accommodate a reservation
* of size 'delta'.
*/
-static int gather_surplus_pages(struct hstate *h, int delta)
+static int gather_surplus_pages(struct hstate *h, long delta)
__must_hold(&hugetlb_lock)
{
struct list_head surplus_list;
--
1.9.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] mm: hugetlb: fix type of delta parameter in gather_surplus_pages()
2020-11-18 13:14 [PATCH] mm: hugetlb: fix type of delta parameter in gather_surplus_pages() Liu Xiang
@ 2020-11-18 18:41 ` Mike Kravetz
2020-11-19 9:18 ` 回复:[PATCH] " liu xiang
0 siblings, 1 reply; 3+ messages in thread
From: Mike Kravetz @ 2020-11-18 18:41 UTC (permalink / raw)
To: Liu Xiang, linux-mm; +Cc: akpm, linux-kernel, liuxiang_1999, Pan Jiagen
On 11/18/20 5:14 AM, Liu Xiang wrote:
> On 64-bit machine, delta variable in hugetlb_acct_memory() may be larger
> than 0xffffffff, but gather_surplus_pages() can only use the low 32-bit
> value now.
>
> Reported-by: Ma Chenggong <ma.chenggong@zlingsmart.com>
> Signed-off-by: Liu Xiang <liu.xiang@zlingsmart.com>
> Signed-off-by: Pan Jiagen <pan.jiagen@zlingsmart.com>
> ---
> mm/hugetlb.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/mm/hugetlb.c b/mm/hugetlb.c
> index 37f15c3..293b36d 100644
> --- a/mm/hugetlb.c
> +++ b/mm/hugetlb.c
> @@ -1943,7 +1943,7 @@ struct page *alloc_huge_page_vma(struct hstate *h, struct vm_area_struct *vma,
> * Increase the hugetlb pool such that it can accommodate a reservation
> * of size 'delta'.
> */
> -static int gather_surplus_pages(struct hstate *h, int delta)
> +static int gather_surplus_pages(struct hstate *h, long delta)
> __must_hold(&hugetlb_lock)
> {
> struct list_head surplus_list;
Thank you for noticing the type difference.
However, if the parameter delta is changed to long then we should also change
the local variables in gather_surplus_pages that are used with delta.
Specifically, the local variables 'needed', 'allocated' and 'i' should also be
of type long.
--
Mike Kravetz
^ permalink raw reply [flat|nested] 3+ messages in thread
* 回复:[PATCH] mm: hugetlb: fix type of delta parameter in gather_surplus_pages()
2020-11-18 18:41 ` Mike Kravetz
@ 2020-11-19 9:18 ` liu xiang
0 siblings, 0 replies; 3+ messages in thread
From: liu xiang @ 2020-11-19 9:18 UTC (permalink / raw)
To: linux-mm, Mike Kravetz; +Cc: akpm, linux-kernel, liuxiang_1999, pan jiagen
Thanks for your advice. I will send a v2 patch.
------------------------------------------------------------------
发件人:Mike Kravetz <mike.kravetz@oracle.com>
发送时间:2020年11月19日(星期四) 02:44
收件人:liu xiang <liu.xiang@zlingsmart.com>; linux-mm <linux-mm@kvack.org>
抄 送:akpm <akpm@linux-foundation.org>; linux-kernel <linux-kernel@vger.kernel.org>; liuxiang_1999 <liuxiang_1999@126.com>; pan jiagen <pan.jiagen@zlingsmart.com>
主 题:Re: [PATCH] mm: hugetlb: fix type of delta parameter in gather_surplus_pages()
On 11/18/20 5:14 AM, Liu Xiang wrote:
> On 64-bit machine, delta variable in hugetlb_acct_memory() may be larger
> than 0xffffffff, but gather_surplus_pages() can only use the low 32-bit
> value now.
>
> Reported-by: Ma Chenggong <ma.chenggong@zlingsmart.com>
> Signed-off-by: Liu Xiang <liu.xiang@zlingsmart.com>
> Signed-off-by: Pan Jiagen <pan.jiagen@zlingsmart.com>
> ---
> mm/hugetlb.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/mm/hugetlb.c b/mm/hugetlb.c
> index 37f15c3..293b36d 100644
> --- a/mm/hugetlb.c
> +++ b/mm/hugetlb.c
> @@ -1943,7 +1943,7 @@ struct page *alloc_huge_page_vma(struct hstate *h, struct vm_area_struct *vma,
> * Increase the hugetlb pool such that it can accommodate a reservation
> * of size 'delta'.
> */
> -static int gather_surplus_pages(struct hstate *h, int delta)
> +static int gather_surplus_pages(struct hstate *h, long delta)
> __must_hold(&hugetlb_lock)
> {
> struct list_head surplus_list;
Thank you for noticing the type difference.
However, if the parameter delta is changed to long then we should also change
the local variables in gather_surplus_pages that are used with delta.
Specifically, the local variables 'needed', 'allocated' and 'i' should also be
of type long.
--
Mike Kravetz
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-11-19 9:19 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-18 13:14 [PATCH] mm: hugetlb: fix type of delta parameter in gather_surplus_pages() Liu Xiang
2020-11-18 18:41 ` Mike Kravetz
2020-11-19 9:18 ` 回复:[PATCH] " liu xiang
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).