* [PATCH v2] mm: hugetlb: fix type of delta parameter and related local variables in gather_surplus_pages()
@ 2020-11-19 13:48 Liu Xiang
2020-11-19 18:34 ` Mike Kravetz
0 siblings, 1 reply; 2+ messages in thread
From: Liu Xiang @ 2020-11-19 13:48 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. So we need to fix type of delta parameter and related local
variables in gather_surplus_pages().
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>
---
Changes in v2:
as suggested by Mike, apply the same fix to the related local
variables in gather_surplus_pages().
---
---
mm/hugetlb.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 37f15c3..3797401 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -1943,13 +1943,14 @@ 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;
struct page *page, *tmp;
- int ret, i;
- int needed, allocated;
+ int ret;
+ long i;
+ long needed, allocated;
bool alloc_ok = true;
needed = (h->resv_huge_pages + delta) - h->free_huge_pages;
--
1.9.1
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH v2] mm: hugetlb: fix type of delta parameter and related local variables in gather_surplus_pages()
2020-11-19 13:48 [PATCH v2] mm: hugetlb: fix type of delta parameter and related local variables in gather_surplus_pages() Liu Xiang
@ 2020-11-19 18:34 ` Mike Kravetz
0 siblings, 0 replies; 2+ messages in thread
From: Mike Kravetz @ 2020-11-19 18:34 UTC (permalink / raw)
To: Liu Xiang, linux-mm; +Cc: akpm, linux-kernel, liuxiang_1999, Pan Jiagen
On 11/19/20 5:48 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. So we need to fix type of delta parameter and related local
> variables in gather_surplus_pages().
>
> 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>
>
> ---
> Changes in v2:
> as suggested by Mike, apply the same fix to the related local
> variables in gather_surplus_pages().
> ---
> ---
> mm/hugetlb.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
Thank you,
Reviewed-by: Mike Kravetz <mike.kravetz@oracle.com>
--
Mike Kravetz
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-11-19 18:34 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-11-19 13:48 [PATCH v2] mm: hugetlb: fix type of delta parameter and related local variables in gather_surplus_pages() Liu Xiang
2020-11-19 18:34 ` Mike Kravetz
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).