Skip to contentSkip to conversation

handle error of rmqueue_bulk

RFC In review Shaohua Li 2 participants 2 messages Dec 14, 2007

Subsystems (2)
lore
Share & tools
lore

Shaohua Li

author
#0 lore raw

RFC 1/1 handle error of rmqueue_bulk

if rmqueue_bulk fails, we might get page with wrong migratetype, shouldn't we consider the case?

Thanks,
Shaohua

mm/page_alloc.c +5 -1
Index: linux/mm/page_alloc.c
===================================================================
@@ -1067,8 +1067,12 @@ again:
 
 		/* Allocate more to the pcp list if necessary */
 		if (unlikely(&page->lru == &pcp->list)) {
-			pcp->count += rmqueue_bulk(zone, 0,
+			int cn;
+			cn = rmqueue_bulk(zone, 0,
 					pcp->batch, &pcp->list, migratetype);
+			if (unlikely(!cn))
+				goto failed;
+			pcp->count += cn;
 			page = list_entry(pcp->list.next, struct page, lru);
 		}
 
#1 lore raw

On (14/12/07 17:08), Shaohua Li didst pronounce:

Quoted 3 lines

if rmqueue_bulk fails, we might get page with wrong migratetype, shouldn't we consider the case?

No. It is not a page allocation failure when this occurs, at worst fragmentation gets a little worse. At this point, it is known the per-cpu list contains pages so if one of the appropriate migrate type cannot be found, fragmentation is allowed to get a little worse instead of failing.

Quoted 23 lines

Thanks,
Shaohua

Index: linux/mm/page_alloc.c
===================================================================

mm/page_alloc.c +5 -1
@@ -1067,8 +1067,12 @@ again:
 
 		/* Allocate more to the pcp list if necessary */
 		if (unlikely(&page->lru == &pcp->list)) {
-			pcp->count += rmqueue_bulk(zone, 0,
+			int cn;
+			cn = rmqueue_bulk(zone, 0,
 					pcp->batch, &pcp->list, migratetype);
+			if (unlikely(!cn))
+				goto failed;
+			pcp->count += cn;
 			page = list_entry(pcp->list.next, struct page, lru);
 		}
 
Signature · 3 lines
Mel Gorman
Part-time Phd Student                          Linux Technology Center
University of Limerick                         IBM Dublin Software Lab