* mmc: queue: amend buffer swap for non-blocking transfer
@ 2012-09-28 10:12 Seungwon Jeon
2012-09-28 11:28 ` Per Forlin
2012-10-23 21:01 ` Chris Ball
0 siblings, 2 replies; 4+ messages in thread
From: Seungwon Jeon @ 2012-09-28 10:12 UTC (permalink / raw)
To: linux-mmc; +Cc: 'Chris Ball', 'Per Forlin'
In case both 'req' and 'mq->mqrq_prev->req' are null, there is no request
to be processed. That means there is no need to switch buffer.
Switching buffer is required only after finishing 'issue_fn'.
Signed-off-by: Seungwon Jeon <tgih.jun@samsung.com>
---
drivers/mmc/card/queue.c | 17 ++++++++++-------
1 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/drivers/mmc/card/queue.c b/drivers/mmc/card/queue.c
index e360a97..fadf52e 100644
--- a/drivers/mmc/card/queue.c
+++ b/drivers/mmc/card/queue.c
@@ -68,6 +68,16 @@ static int mmc_queue_thread(void *d)
if (req || mq->mqrq_prev->req) {
set_current_state(TASK_RUNNING);
mq->issue_fn(mq, req);
+
+ /*
+ * Current request becomes previous request
+ * and vice versa.
+ */
+ mq->mqrq_prev->brq.mrq.data = NULL;
+ mq->mqrq_prev->req = NULL;
+ tmp = mq->mqrq_prev;
+ mq->mqrq_prev = mq->mqrq_cur;
+ mq->mqrq_cur = tmp;
} else {
if (kthread_should_stop()) {
set_current_state(TASK_RUNNING);
@@ -77,13 +87,6 @@ static int mmc_queue_thread(void *d)
schedule();
down(&mq->thread_sem);
}
-
- /* Current request becomes previous request and vice versa. */
- mq->mqrq_prev->brq.mrq.data = NULL;
- mq->mqrq_prev->req = NULL;
- tmp = mq->mqrq_prev;
- mq->mqrq_prev = mq->mqrq_cur;
- mq->mqrq_cur = tmp;
} while (1);
up(&mq->thread_sem);
--
1.7.0.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: mmc: queue: amend buffer swap for non-blocking transfer
2012-09-28 10:12 mmc: queue: amend buffer swap for non-blocking transfer Seungwon Jeon
@ 2012-09-28 11:28 ` Per Forlin
2012-09-28 11:31 ` Johan Rudholm
2012-10-23 21:01 ` Chris Ball
1 sibling, 1 reply; 4+ messages in thread
From: Per Forlin @ 2012-09-28 11:28 UTC (permalink / raw)
To: Seungwon Jeon; +Cc: linux-mmc, Chris Ball
Hi,
This is really a micro optimization. Still the patch looks correct.
CUR and PREV will have the same values before and after this patch.
Before this patch, NULL was assigned to NULL which is not necessary of course.
Reviewed-by: Per Forlin <per.forlin@stericsson.com>
Thanks,
Per
On Fri, Sep 28, 2012 at 12:12 PM, Seungwon Jeon <tgih.jun@samsung.com> wrote:
> In case both 'req' and 'mq->mqrq_prev->req' are null, there is no request
> to be processed. That means there is no need to switch buffer.
> Switching buffer is required only after finishing 'issue_fn'.
>
> Signed-off-by: Seungwon Jeon <tgih.jun@samsung.com>
> ---
> drivers/mmc/card/queue.c | 17 ++++++++++-------
> 1 files changed, 10 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/mmc/card/queue.c b/drivers/mmc/card/queue.c
> index e360a97..fadf52e 100644
> --- a/drivers/mmc/card/queue.c
> +++ b/drivers/mmc/card/queue.c
> @@ -68,6 +68,16 @@ static int mmc_queue_thread(void *d)
> if (req || mq->mqrq_prev->req) {
> set_current_state(TASK_RUNNING);
> mq->issue_fn(mq, req);
> +
> + /*
> + * Current request becomes previous request
> + * and vice versa.
> + */
> + mq->mqrq_prev->brq.mrq.data = NULL;
> + mq->mqrq_prev->req = NULL;
> + tmp = mq->mqrq_prev;
> + mq->mqrq_prev = mq->mqrq_cur;
> + mq->mqrq_cur = tmp;
> } else {
> if (kthread_should_stop()) {
> set_current_state(TASK_RUNNING);
> @@ -77,13 +87,6 @@ static int mmc_queue_thread(void *d)
> schedule();
> down(&mq->thread_sem);
> }
> -
> - /* Current request becomes previous request and vice versa. */
> - mq->mqrq_prev->brq.mrq.data = NULL;
> - mq->mqrq_prev->req = NULL;
> - tmp = mq->mqrq_prev;
> - mq->mqrq_prev = mq->mqrq_cur;
> - mq->mqrq_cur = tmp;
> } while (1);
> up(&mq->thread_sem);
>
> --
> 1.7.0.4
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: mmc: queue: amend buffer swap for non-blocking transfer
2012-09-28 11:28 ` Per Forlin
@ 2012-09-28 11:31 ` Johan Rudholm
0 siblings, 0 replies; 4+ messages in thread
From: Johan Rudholm @ 2012-09-28 11:31 UTC (permalink / raw)
To: Per Forlin; +Cc: Seungwon Jeon, linux-mmc, Chris Ball
Hi,
Tested-by: Johan Rudholm <johan.rudholm@stericsson.com>
//Johan
2012/9/28 Per Forlin <per.lkml@gmail.com>:
> Hi,
>
> This is really a micro optimization. Still the patch looks correct.
> CUR and PREV will have the same values before and after this patch.
> Before this patch, NULL was assigned to NULL which is not necessary of course.
>
> Reviewed-by: Per Forlin <per.forlin@stericsson.com>
>
> Thanks,
> Per
>
> On Fri, Sep 28, 2012 at 12:12 PM, Seungwon Jeon <tgih.jun@samsung.com> wrote:
>> In case both 'req' and 'mq->mqrq_prev->req' are null, there is no request
>> to be processed. That means there is no need to switch buffer.
>> Switching buffer is required only after finishing 'issue_fn'.
>>
>> Signed-off-by: Seungwon Jeon <tgih.jun@samsung.com>
>> ---
>> drivers/mmc/card/queue.c | 17 ++++++++++-------
>> 1 files changed, 10 insertions(+), 7 deletions(-)
>>
>> diff --git a/drivers/mmc/card/queue.c b/drivers/mmc/card/queue.c
>> index e360a97..fadf52e 100644
>> --- a/drivers/mmc/card/queue.c
>> +++ b/drivers/mmc/card/queue.c
>> @@ -68,6 +68,16 @@ static int mmc_queue_thread(void *d)
>> if (req || mq->mqrq_prev->req) {
>> set_current_state(TASK_RUNNING);
>> mq->issue_fn(mq, req);
>> +
>> + /*
>> + * Current request becomes previous request
>> + * and vice versa.
>> + */
>> + mq->mqrq_prev->brq.mrq.data = NULL;
>> + mq->mqrq_prev->req = NULL;
>> + tmp = mq->mqrq_prev;
>> + mq->mqrq_prev = mq->mqrq_cur;
>> + mq->mqrq_cur = tmp;
>> } else {
>> if (kthread_should_stop()) {
>> set_current_state(TASK_RUNNING);
>> @@ -77,13 +87,6 @@ static int mmc_queue_thread(void *d)
>> schedule();
>> down(&mq->thread_sem);
>> }
>> -
>> - /* Current request becomes previous request and vice versa. */
>> - mq->mqrq_prev->brq.mrq.data = NULL;
>> - mq->mqrq_prev->req = NULL;
>> - tmp = mq->mqrq_prev;
>> - mq->mqrq_prev = mq->mqrq_cur;
>> - mq->mqrq_cur = tmp;
>> } while (1);
>> up(&mq->thread_sem);
>>
>> --
>> 1.7.0.4
>>
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at http://vger.kernel.org/majordomo-info.html
> --
> To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: mmc: queue: amend buffer swap for non-blocking transfer
2012-09-28 10:12 mmc: queue: amend buffer swap for non-blocking transfer Seungwon Jeon
2012-09-28 11:28 ` Per Forlin
@ 2012-10-23 21:01 ` Chris Ball
1 sibling, 0 replies; 4+ messages in thread
From: Chris Ball @ 2012-10-23 21:01 UTC (permalink / raw)
To: Seungwon Jeon; +Cc: linux-mmc, 'Per Forlin'
Hi,
On Fri, Sep 28 2012, Seungwon Jeon wrote:
> In case both 'req' and 'mq->mqrq_prev->req' are null, there is no request
> to be processed. That means there is no need to switch buffer.
> Switching buffer is required only after finishing 'issue_fn'.
>
> Signed-off-by: Seungwon Jeon <tgih.jun@samsung.com>
> ---
> drivers/mmc/card/queue.c | 17 ++++++++++-------
> 1 files changed, 10 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/mmc/card/queue.c b/drivers/mmc/card/queue.c
> index e360a97..fadf52e 100644
> --- a/drivers/mmc/card/queue.c
> +++ b/drivers/mmc/card/queue.c
> @@ -68,6 +68,16 @@ static int mmc_queue_thread(void *d)
> if (req || mq->mqrq_prev->req) {
> set_current_state(TASK_RUNNING);
> mq->issue_fn(mq, req);
> +
> + /*
> + * Current request becomes previous request
> + * and vice versa.
> + */
> + mq->mqrq_prev->brq.mrq.data = NULL;
> + mq->mqrq_prev->req = NULL;
> + tmp = mq->mqrq_prev;
> + mq->mqrq_prev = mq->mqrq_cur;
> + mq->mqrq_cur = tmp;
> } else {
> if (kthread_should_stop()) {
> set_current_state(TASK_RUNNING);
> @@ -77,13 +87,6 @@ static int mmc_queue_thread(void *d)
> schedule();
> down(&mq->thread_sem);
> }
> -
> - /* Current request becomes previous request and vice versa. */
> - mq->mqrq_prev->brq.mrq.data = NULL;
> - mq->mqrq_prev->req = NULL;
> - tmp = mq->mqrq_prev;
> - mq->mqrq_prev = mq->mqrq_cur;
> - mq->mqrq_cur = tmp;
> } while (1);
> up(&mq->thread_sem);
Thanks, pushed to mmc-next for 3.8.
- Chris.
--
Chris Ball <cjb@laptop.org> <http://printf.net/>
One Laptop Per Child
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-10-23 21:01 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-28 10:12 mmc: queue: amend buffer swap for non-blocking transfer Seungwon Jeon
2012-09-28 11:28 ` Per Forlin
2012-09-28 11:31 ` Johan Rudholm
2012-10-23 21:01 ` Chris Ball
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox