From: Adrian Hunter <adrian.hunter@nokia.com>
To: Chris Ball <cjb@laptop.org>
Cc: linux-mmc Mailing List <linux-mmc@vger.kernel.org>,
Adrian Hunter <adrian.hunter@nokia.com>
Subject: [PATCH 1/2] mmc_test: fix memory allocation segment limits
Date: Thu, 23 Sep 2010 14:51:29 +0300 [thread overview]
Message-ID: <20100923115129.18000.59696.sendpatchset@ahunter-work.research.nokia.com> (raw)
In-Reply-To: <20100923115122.18000.46750.sendpatchset@ahunter-work.research.nokia.com>
>From aad98716cd9e8f83831721010d58d2a9f8ea2d2b Mon Sep 17 00:00:00 2001
From: Adrian Hunter <adrian.hunter@nokia.com>
Date: Thu, 23 Sep 2010 12:55:15 +0300
Subject: [PATCH 1/2] mmc_test: fix memory allocation segment limits
Correctly allocate memory to meet the host controller
driver's maximum segment size and count limits.
Signed-off-by: Adrian Hunter <adrian.hunter@nokia.com>
---
drivers/mmc/card/mmc_test.c | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/mmc/card/mmc_test.c b/drivers/mmc/card/mmc_test.c
index 6580af7..5874040 100644
--- a/drivers/mmc/card/mmc_test.c
+++ b/drivers/mmc/card/mmc_test.c
@@ -318,8 +318,8 @@ static struct mmc_test_mem *mmc_test_alloc_mem(unsigned long min_sz,
if (max_page_cnt > limit)
max_page_cnt = limit;
- if (max_page_cnt < min_page_cnt)
- max_page_cnt = min_page_cnt;
+ if (min_page_cnt > max_page_cnt)
+ min_page_cnt = max_page_cnt;
if (max_seg_page_cnt > max_page_cnt)
max_seg_page_cnt = max_page_cnt;
@@ -359,13 +359,13 @@ static struct mmc_test_mem *mmc_test_alloc_mem(unsigned long min_sz,
mem->cnt += 1;
if (max_page_cnt <= (1UL << order))
break;
+ max_page_cnt -= 1UL << order;
+ page_cnt += 1UL << order;
if (mem->cnt >= max_segs) {
if (page_cnt < min_page_cnt)
goto out_free;
break;
}
- max_page_cnt -= 1UL << order;
- page_cnt += 1UL << order;
}
return mem;
@@ -1470,12 +1470,12 @@ static int mmc_test_area_init(struct mmc_test_card *test, int erase, int fill)
t->max_tfr = t->max_segs * t->max_seg_sz;
/*
- * Try to allocate enough memory for the whole area. Less is OK
+ * Try to allocate enough memory for a max. sized transfer. Less is OK
* because the same memory can be mapped into the scatterlist more than
* once. Also, take into account the limits imposed on scatterlist
* segments by the host driver.
*/
- t->mem = mmc_test_alloc_mem(min_sz, t->max_sz, t->max_segs,
+ t->mem = mmc_test_alloc_mem(min_sz, t->max_tfr, t->max_segs,
t->max_seg_sz);
if (!t->mem)
return -ENOMEM;
--
1.7.0.4
next prev parent reply other threads:[~2010-09-23 11:51 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-23 11:51 [PATCH 0/2] mmc_test performance test fixes Adrian Hunter
2010-09-23 11:51 ` Adrian Hunter [this message]
2010-09-24 21:15 ` [PATCH 1/2] mmc_test: fix memory allocation segment limits Chris Ball
2010-09-23 11:51 ` [PATCH 2/2] mmc_test: fix display of .5 KiB Adrian Hunter
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=20100923115129.18000.59696.sendpatchset@ahunter-work.research.nokia.com \
--to=adrian.hunter@nokia.com \
--cc=cjb@laptop.org \
--cc=linux-mmc@vger.kernel.org \
/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