Re: [RFC PATCH] mm: page_alloc: High-order per-cpu page allocator

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 11/23/2016 05:33 PM, Mel Gorman wrote:
+
+static inline unsigned int pindex_to_order(unsigned int pindex)
+{
+	return pindex < MIGRATE_PCPTYPES ? 0 : pindex - MIGRATE_PCPTYPES + 1;
+}
+
+static inline unsigned int order_to_pindex(int migratetype, unsigned int order)
+{
+	return (order == 0) ? migratetype : MIGRATE_PCPTYPES - 1 + order;

Here I think that "MIGRATE_PCPTYPES + order - 1" would be easier to
understand as the array is for all migratetypes, but the order is shifted?


As in migratetypes * costly_order ? That would be excessively large.

No, I just meant that instead of "MIGRATE_PCPTYPES - 1 + order" it could be "MIGRATE_PCPTYPES + order - 1" as we are subtracting from order, not migratetypes. Just made me confused a bit when seeing the code for the first time.

@@ -1083,10 +1083,12 @@ static bool bulkfree_pcp_prepare(struct page *page)
  * pinned" detection logic.
  */
 static void free_pcppages_bulk(struct zone *zone, int count,
-					struct per_cpu_pages *pcp)
+					struct per_cpu_pages *pcp,
+					int migratetype)
 {
-	int migratetype = 0;
-	int batch_free = 0;
+	unsigned int pindex = 0;

Should pindex be initialized to migratetype to match the list below?


Functionally it doesn't matter. It affects which list is tried first if
the preferred list is empty. Arguably it would make more sense to init
it to NR_PCP_LISTS - 1 so all order-0 lists are always drained before the
high-order pages but there is not much justification for that.

OK

I'll take your suggestion until there is data supporting that high-order
caches should be preserved.

Thanks.


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



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]