Skip to contentSkip to conversation

mm/page_alloc.c: variable type of 'progress' should be 'unsigned long'

PATCH In review [email protected] 2 participants 3 messages Sep 15, 2020 – Sep 16, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mm/page_alloc.c: variable type of 'progress' should be 'unsigned long'

From: Yanfei Xu <[email protected]>

try_to_free_pages returns the number of pages reclaimed, and the type of returns is 'unsigned long'. So we should use a matched type for storing it.

---
 mm/page_alloc.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
mm/page_alloc.c +1 -2
index fab5e97dc9ca..5f1016c70b94 100644
@@ -4245,9 +4245,8 @@ static int
 __perform_reclaim(gfp_t gfp_mask, unsigned int order,
 					const struct alloc_context *ac)
 {
-	int progress;
 	unsigned int noreclaim_flag;
-	unsigned long pflags;
+	unsigned long pflags, progress;
 
 	cond_resched();
 
Signature · 1 line
2.18.2
maintainer
#1 lore raw
Quoted 6 lines · On Tue, 15 Sep 2020 18:46:20 +0800 <[email protected]> wrote:

From: Yanfei Xu <[email protected]>

try_to_free_pages returns the number of pages reclaimed, and the type of returns is 'unsigned long'. So we should use a matched type for storing it.

__perform_reclaim() returns an int, so this change is fairly pointless.

However __perform_reclaim()'s single caller expects it to return unsigned long, so including that change in this patch would make more sense.

author
#2 lore raw
Quoted 9 lines · Andrew Morton
Quoted 6 lines · On Tue, 15 Sep 2020 18:46:20 +0800 <[email protected]> wrote:

From: Yanfei Xu <[email protected]>

try_to_free_pages returns the number of pages reclaimed, and the type of returns is 'unsigned long'. So we should use a matched type for storing it.

Quoted 6 lines

__perform_reclaim() returns an int, so this change is fairly pointless.

However __perform_reclaim()'s single caller expects it to return unsigned long, so including that change in this patch would make more sense.

Yeah, thanks for reminding. I will add that and send a v2. :)

Regards,
Yanfei