Skip to contentSkip to conversation

mm, page_alloc: reserve pageblocks for high-order atomic allocations on demand -fix

PATCH In review yalin wang 4 participants 4 messages Oct 13, 2015 – Oct 14, 2015

Subsystems (2)
lore
Share & tools
lore

yalin wang

author
#0 lore raw

PATCH v2 1/1 mm, page_alloc: reserve pageblocks for high-order atomic allocations on demand -fix

There is a redundant check and a memory leak introduced by a patch in mmotm. This patch removes an unlikely(order) check as we are sure order is not zero at the time. It also checks if a page is already allocated to avoid a memory leak.

This is a fix to the mmotm patch mm-page_alloc-reserve-pageblocks-for-high-order-atomic-allocations-on-demand.patch

---
 mm/page_alloc.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
mm/page_alloc.c +3 -3
index 0d6f540..043b691 100644
@@ -2241,13 +2241,13 @@ struct page *buffered_rmqueue(struct zone *preferred_zone,
 		spin_lock_irqsave(&zone->lock, flags);
 
 		page = NULL;
-		if (unlikely(order) && (alloc_flags & ALLOC_HARDER)) {
+		if (alloc_flags & ALLOC_HARDER) {
 			page = __rmqueue_smallest(zone, order, MIGRATE_HIGHATOMIC);
 			if (page)
 				trace_mm_page_alloc_zone_locked(page, order, migratetype);
 		}
-
-		page = __rmqueue(zone, order, migratetype, gfp_flags);
+		if (!page)
+			page = __rmqueue(zone, order, migratetype, gfp_flags);
 		spin_unlock(&zone->lock);
 		if (!page)
 			goto failed;
Signature · 7 lines
1.9.1

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Acked-by on v2 1/1
#1 lore raw
Quoted 10 lines · yalin wang

There is a redundant check and a memory leak introduced by a patch in mmotm. This patch removes an unlikely(order) check as we are sure order is not zero at the time. It also checks if a page is already allocated to avoid a memory leak.

This is a fix to the mmotm patch mm-page_alloc-reserve-pageblocks-for-high-order-atomic-allocations-on-demand.patch

Quoted 16 lines
---
  mm/page_alloc.c | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)
mm/page_alloc.c +1 -1
index 0d6f540..043b691 100644
@@ -2241,13 +2241,13 @@ struct page *buffered_rmqueue(struct zone *preferred_zone,
  		spin_lock_irqsave(&zone->lock, flags);
 
  		page = NULL;
-		if (unlikely(order) && (alloc_flags & ALLOC_HARDER)) {
+		if (alloc_flags & ALLOC_HARDER) {
  			page = __rmqueue_smallest(zone, order, MIGRATE_HIGHATOMIC);

mm/page_alloc.c struct page *buffered_rmqueue(struct zone *preferred_zone, · line 2253

Quoted 10 lines
mm/page_alloc.c +2 -2
  			if (page)
  				trace_mm_page_alloc_zone_locked(page, order, migratetype);
  		}
-
-		page = __rmqueue(zone, order, migratetype, gfp_flags);
+		if (!page)
+			page = __rmqueue(zone, order, migratetype, gfp_flags);
  		spin_unlock(&zone->lock);
  		if (!page)
  			goto failed;

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

Acked-by on v2 1/1
#2 lore raw
In reply to yalin wang
Quoted 10 lines · yalin wang

There is a redundant check and a memory leak introduced by a patch in mmotm. This patch removes an unlikely(order) check as we are sure order is not zero at the time. It also checks if a page is already allocated to avoid a memory leak.

This is a fix to the mmotm patch mm-page_alloc-reserve-pageblocks-for-high-order-atomic-allocations-on-demand.patch

Signature · 7 lines
 Kirill A. Shutemov

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Acked-by on v2 1/1
#3 lore raw
In reply to yalin wang
Quoted 10 lines · yalin wang

There is a redundant check and a memory leak introduced by a patch in mmotm. This patch removes an unlikely(order) check as we are sure order is not zero at the time. It also checks if a page is already allocated to avoid a memory leak.

This is a fix to the mmotm patch mm-page_alloc-reserve-pageblocks-for-high-order-atomic-allocations-on-demand.patch

Cool find!

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>