Skip to contentSkip to conversation

ion: Consider ion pool pages as indirectly reclaimable

PATCH In review [email protected] 2 participants 5 messages Apr 25, 2018 – Apr 27, 2018 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ion: Consider ion pool pages as indirectly reclaimable

From: Vijayanand Jitta <[email protected]>

An issue is observed where mallocs are failing due to overcommit failure. The failure happens when there is high ION page pool since ION page pool is not considered reclaimable by the overcommit calculation code. This change considers ion pool pages as indirectly reclaimable and thus accounted as available memory in the overcommit calculation.

---
 drivers/staging/android/ion/ion_page_pool.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/staging/android/ion/ion_page_pool.c +5 -0
index db8f614..9bc56eb 100644
@@ -32,6 +32,9 @@ static void ion_page_pool_add(struct ion_page_pool *pool, struct page *page)
 		list_add_tail(&page->lru, &pool->low_items);
 		pool->low_count++;
 	}
+
+	mod_node_page_state(page_pgdat(page), NR_INDIRECTLY_RECLAIMABLE_BYTES,
+			    (1 << (PAGE_SHIFT + pool->order)));
 	mutex_unlock(&pool->mutex);
 }
 
@@ -50,6 +53,8 @@ static struct page *ion_page_pool_remove(struct ion_page_pool *pool, bool high)
 	}
 
 	list_del(&page->lru);
+	mod_node_page_state(page_pgdat(page), NR_INDIRECTLY_RECLAIMABLE_BYTES,
+			    -(1 << (PAGE_SHIFT + pool->order)));
 	return page;
 }
 
Signature · 6 lines
1.9.1

_______________________________________________
devel mailing list
[email protected]
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
#1 lore raw
Quoted 29 lines · On 04/24/2018 08:43 PM, [email protected] wrote:

From: Vijayanand Jitta <[email protected]>

An issue is observed where mallocs are failing due to overcommit failure. The failure happens when there is high ION page pool since ION page pool is not considered reclaimable by the overcommit calculation code. This change considers ion pool pages as indirectly reclaimable and thus accounted as available memory in the overcommit calculation.

---
  drivers/staging/android/ion/ion_page_pool.c | 5 +++++
  1 file changed, 5 insertions(+)
drivers/staging/android/ion/ion_page_pool.c +3 -0
index db8f614..9bc56eb 100644
@@ -32,6 +32,9 @@ static void ion_page_pool_add(struct ion_page_pool *pool, struct page *page)
  		list_add_tail(&page->lru, &pool->low_items);
  		pool->low_count++;
  	}
+
+	mod_node_page_state(page_pgdat(page), NR_INDIRECTLY_RECLAIMABLE_BYTES,
+			    (1 << (PAGE_SHIFT + pool->order)));
  	mutex_unlock(&pool->mutex);
  }
 

drivers/staging/android/ion/ion_page_pool.c static struct page *ion_page_pool_remove(struct ion_page_pool *pool, bool high) · line 60

Quoted 8 lines
drivers/staging/android/ion/ion_page_pool.c +2 -0
@@ -50,6 +53,8 @@ static struct page *ion_page_pool_remove(struct ion_page_pool *pool, bool high)
  	}
 
  	list_del(&page->lru);
+	mod_node_page_state(page_pgdat(page), NR_INDIRECTLY_RECLAIMABLE_BYTES,
+			    -(1 << (PAGE_SHIFT + pool->order)));
  	return page;
  }
 

I'm sure this fixes the problem but I don't think we want to start throwing page adjustments into Ion. Why isn't this memory already considered reclaimable by existing calculations?

Thanks,
Laura

#2 lore raw
Quoted 44 lines · Laura Abbott
Quoted 35 lines · On 04/24/2018 08:43 PM, [email protected] wrote:

From: Vijayanand Jitta <[email protected]>

An issue is observed where mallocs are failing due to overcommit failure. The failure happens when there is high ION page pool since ION page pool is not considered reclaimable by the overcommit calculation code. This change considers ion pool pages as indirectly reclaimable and thus accounted as available memory in the overcommit calculation.

---
  drivers/staging/android/ion/ion_page_pool.c | 5 +++++
  1 file changed, 5 insertions(+)
drivers/staging/android/ion/ion_page_pool.c +3 -0
index db8f614..9bc56eb 100644
@@ -32,6 +32,9 @@ static void ion_page_pool_add(struct ion_page_pool 
 *pool, struct page *page)
  		list_add_tail(&page->lru, &pool->low_items);
  		pool->low_count++;
  	}
+
+	mod_node_page_state(page_pgdat(page), 
 NR_INDIRECTLY_RECLAIMABLE_BYTES,
+			    (1 << (PAGE_SHIFT + pool->order)));
  	mutex_unlock(&pool->mutex);

}
@@ -50,6 +53,8 @@ static struct page *ion_page_pool_remove(struct
ion_page_pool *pool, bool high)
}

    	list_del(&page->lru);
drivers/staging/android/ion/ion_page_pool.c +1 -0
+	mod_node_page_state(page_pgdat(page), 

NR_INDIRECTLY_RECLAIMABLE_BYTES,

drivers/staging/android/ion/ion_page_pool.c static struct page *ion_page_pool_remove(struct ion_page_pool *pool, bool high) · line 59

Quoted 3 lines
drivers/staging/android/ion/ion_page_pool.c +1 -0
+			    -(1 << (PAGE_SHIFT + pool->order)));
  	return page;
  }

I'm sure this fixes the problem but I don't think we want to start throwing page adjustments into Ion. Why isn't this memory already considered reclaimable by existing calculations?

Quoted 2 lines

Thanks,
Laura

You can refer to discussion here https://lkml.org/lkml/2018/3/5/361 introducing NR_INDIRECTLY_RECLAIMABLE_BYTES for the memory which is not currently considered as reclaimable

Thanks,
Vijay
_______________________________________________
devel mailing list
[email protected]
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

#3 lore raw
Quoted 48 lines · On 2018-04-27 10:40, [email protected] wrote:
Quoted 44 lines · Laura Abbott
Quoted 35 lines · On 04/24/2018 08:43 PM, [email protected] wrote:

From: Vijayanand Jitta <[email protected]>

An issue is observed where mallocs are failing due to overcommit failure. The failure happens when there is high ION page pool since ION page pool is not considered reclaimable by the overcommit calculation code. This change considers ion pool pages as indirectly reclaimable and thus accounted as available memory in the overcommit calculation.

---
  drivers/staging/android/ion/ion_page_pool.c | 5 +++++
  1 file changed, 5 insertions(+)
drivers/staging/android/ion/ion_page_pool.c +3 -0
index db8f614..9bc56eb 100644
@@ -32,6 +32,9 @@ static void ion_page_pool_add(struct ion_page_pool 
 *pool, struct page *page)
  		list_add_tail(&page->lru, &pool->low_items);
  		pool->low_count++;
  	}
+
+	mod_node_page_state(page_pgdat(page), 
 NR_INDIRECTLY_RECLAIMABLE_BYTES,
+			    (1 << (PAGE_SHIFT + pool->order)));
  	mutex_unlock(&pool->mutex);

}
@@ -50,6 +53,8 @@ static struct page *ion_page_pool_remove(struct
ion_page_pool *pool, bool high)
}

    	list_del(&page->lru);
drivers/staging/android/ion/ion_page_pool.c +1 -0
+	mod_node_page_state(page_pgdat(page), 

NR_INDIRECTLY_RECLAIMABLE_BYTES,

drivers/staging/android/ion/ion_page_pool.c static struct page *ion_page_pool_remove(struct ion_page_pool *pool, bool high) · line 59

Quoted 3 lines
drivers/staging/android/ion/ion_page_pool.c +1 -0
+			    -(1 << (PAGE_SHIFT + pool->order)));
  	return page;
  }

I'm sure this fixes the problem but I don't think we want to start throwing page adjustments into Ion. Why isn't this memory already considered reclaimable by existing calculations?

Quoted 2 lines

Thanks,
Laura

Quoted 6 lines

You can refer to discussion here https://lkml.org/lkml/2018/3/5/361 introducing NR_INDIRECTLY_RECLAIMABLE_BYTES for the memory which is not currently considered as reclaimable

Thanks,
Vijay

There was also discussion specific to ion in that thread you can find it here
https://lkml.org/lkml/2018/4/25/642

Thanks,
Vijay
_______________________________________________
devel mailing list
[email protected]
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

Acked-by
#4 lore raw
Quoted 49 lines · On 04/27/2018 02:29 AM, [email protected] wrote:
Quoted 48 lines · On 2018-04-27 10:40, [email protected] wrote:
Quoted 40 lines · Laura Abbott
Quoted 27 lines · On 04/24/2018 08:43 PM, [email protected] wrote:

From: Vijayanand Jitta <[email protected]>

An issue is observed where mallocs are failing due to overcommit failure. The failure happens when there is high ION page pool since ION page pool is not considered reclaimable by the overcommit calculation code. This change considers ion pool pages as indirectly reclaimable and thus accounted as available memory in the overcommit calculation.

---
  drivers/staging/android/ion/ion_page_pool.c | 5 +++++

  1 file changed, 5 insertions(+)
drivers/staging/android/ion/ion_page_pool.c +3 -0
index db8f614..9bc56eb 100644
@@ -32,6 +32,9 @@ static void ion_page_pool_add(struct ion_page_pool *pool, struct page *page)
           list_add_tail(&page->lru, &pool->low_items);
           pool->low_count++;
       }
+
+    mod_node_page_state(page_pgdat(page), NR_INDIRECTLY_RECLAIMABLE_BYTES,
+                (1 << (PAGE_SHIFT + pool->order)));
       mutex_unlock(&pool->mutex);
   }
   @@ -50,6 +53,8 @@ static struct page *ion_page_pool_remove(struct ion_page_pool *pool, bool high)
Quoted 7 lines

      }
        list_del(&page->lru);
+    mod_node_page_state(page_pgdat(page), NR_INDIRECTLY_RECLAIMABLE_BYTES, +                -(1 << (PAGE_SHIFT + pool->order)));
      return page;
  }

I'm sure this fixes the problem but I don't think we want to start throwing page adjustments into Ion. Why isn't this memory already considered reclaimable by existing calculations?

Quoted 2 lines

Thanks,
Laura

You can refer to discussion here https://lkml.org/lkml/2018/3/5/361 introducing NR_INDIRECTLY_RECLAIMABLE_BYTES for the memory which is not currently considered as reclaimable

Quoted 8 lines
Quoted 2 lines

Thanks,
Vijay

There was also discussion specific to ion in that thread you can find it here
https://lkml.org/lkml/2018/4/25/642

Thanks,
Vijay

Thanks for pointing that thread out. I'm still a little wary since Ion is in staging but if the rest of mm are okay with it

Thanks,
Laura

_______________________________________________
devel mailing list
[email protected]
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel