From: "Ian Munsie" <imunsie@au1.ibm.com>
To: Michael Ellerman <mpe@ellerman.id.au>, mikey <mikey@neuling.org>,
linuxppc-dev@lists.ozlabs.org,
Frederic Barrat <frederic.barrat@fr.ibm.com>,
Huy Nguyen <huyn@mellanox.com>
Cc: Ian Munsie <imunsie@au1.ibm.com>
Subject: [PATCH 2/2] cxl: Fix allocating a minimum of 2 pages for the SPA
Date: Wed, 29 Jun 2016 22:16:26 +1000 [thread overview]
Message-ID: <1467202586-13412-2-git-send-email-imunsie@au.ibm.com> (raw)
In-Reply-To: <1467202586-13412-1-git-send-email-imunsie@au.ibm.com>
From: Ian Munsie <imunsie@au1.ibm.com>
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>
---
drivers/misc/cxl/native.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/misc/cxl/native.c b/drivers/misc/cxl/native.c
index e80d8f7..120c468 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)
unsigned spa_size;
/* Work out how many pages to allocate */
- afu->native->spa_order = 0;
+ afu->native->spa_order = -1;
do {
afu->native->spa_order++;
spa_size = (1 << afu->native->spa_order) * PAGE_SIZE;
--
2.8.1
next prev parent reply other threads:[~2016-06-29 12:17 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-29 12:16 [PATCH 1/2] cxl: Fix allowing bogus AFU descriptors with 0 maximum processes Ian Munsie
2016-06-29 12:16 ` Ian Munsie [this message]
2016-06-29 16:06 ` [PATCH 2/2] cxl: Fix allocating a minimum of 2 pages for the SPA Frederic Barrat
2016-06-29 23:07 ` Andrew Donnellan
2016-07-11 10:19 ` [2/2] " Michael Ellerman
2016-06-29 16:06 ` [PATCH 1/2] cxl: Fix allowing bogus AFU descriptors with 0 maximum processes Frederic Barrat
2016-06-29 22:35 ` Andrew Donnellan
2016-07-11 10:19 ` [1/2] " Michael Ellerman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1467202586-13412-2-git-send-email-imunsie@au.ibm.com \
--to=imunsie@au1.ibm.com \
--cc=frederic.barrat@fr.ibm.com \
--cc=huyn@mellanox.com \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mikey@neuling.org \
--cc=mpe@ellerman.id.au \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).