summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIan Munsie <imunsie@au1.ibm.com>2016-06-29 08:16:26 -0400
committerMichael Ellerman <mpe@ellerman.id.au>2016-07-08 08:10:44 -0400
commit2224b6719b09052a9fbf29422a0e9b4f42407c35 (patch)
treea64dfc31e0088296859c867bf3c9d2035599e095
parent49e9c99f47fc43abc9598f9fcf5ba3336d0c09a6 (diff)
cxl: Fix allocating a minimum of 2 pages for the SPA
The Scheduled Process Area is allocated dynamically with enough pages to fit at least as many processes as the AFU descriptor indicated. Since the calculation is non-trivial, it does this by calculating how many processes could fit in an allocation of a given order, and increasing that order until it can fit enough processes or hits the maximum supported size. Currently, it will start this search using a SPA of 2 pages instead of 1. This can waste a page of memory if the AFU's maximum number of supported processes was small enough to fit in one page. Fix the algorithm to start the search at 1 page. Signed-off-by: Ian Munsie <imunsie@au1.ibm.com> Reviewed-by: Frederic Barrat <fbarrat@linux.vnet.ibm.com> Reviewed-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
-rw-r--r--drivers/misc/cxl/native.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/misc/cxl/native.c b/drivers/misc/cxl/native.c
index e80d8f7d4dcb..120c468ee9e0 100644
--- a/drivers/misc/cxl/native.c
+++ b/drivers/misc/cxl/native.c
@@ -189,7 +189,7 @@ int cxl_alloc_spa(struct cxl_afu *afu)
189 unsigned spa_size; 189 unsigned spa_size;
190 190
191 /* Work out how many pages to allocate */ 191 /* Work out how many pages to allocate */
192 afu->native->spa_order = 0; 192 afu->native->spa_order = -1;
193 do { 193 do {
194 afu->native->spa_order++; 194 afu->native->spa_order++;
195 spa_size = (1 << afu->native->spa_order) * PAGE_SIZE; 195 spa_size = (1 << afu->native->spa_order) * PAGE_SIZE;