* [PATCH] aio: avoid using queue_delayed_work in aio_kick_handler to schedule itself
@ 2008-06-26 3:57 Nikanth Karthikesan
2008-06-27 13:11 ` Jeff Moyer
0 siblings, 1 reply; 5+ messages in thread
From: Nikanth Karthikesan @ 2008-06-26 3:57 UTC (permalink / raw)
To: linux-aio; +Cc: linux-kernel, Benjamin LaHaise, Jeff Moyer, Zach Brown
Avoid using queue_delayed_work in aio_kick_handler() to run itself
immediately. Instead use aio_run_all_iocbs()
Signed-off-by: Nikanth Karthikesan <knikanth@suse.de>
---
diff --git a/fs/aio.c b/fs/aio.c
index e27f611..7817e8f 100644
--- a/fs/aio.c
+++ b/fs/aio.c
@@ -823,21 +823,13 @@ static void aio_kick_handler(struct work_struct *work)
struct kioctx *ctx = container_of(work, struct kioctx, wq.work);
mm_segment_t oldfs = get_fs();
struct mm_struct *mm;
- int requeue;
set_fs(USER_DS);
- use_mm(ctx->mm);
- spin_lock_irq(&ctx->ctx_lock);
- requeue =__aio_run_iocbs(ctx);
mm = ctx->mm;
- spin_unlock_irq(&ctx->ctx_lock);
+ use_mm(mm);
+ aio_run_all_iocbs(ctx);
unuse_mm(mm);
set_fs(oldfs);
- /*
- * we're in a worker thread already, don't use queue_delayed_work,
- */
- if (requeue)
- queue_delayed_work(aio_wq, &ctx->wq, 0);
}
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] aio: avoid using queue_delayed_work in aio_kick_handler to schedule itself
2008-06-26 3:57 [PATCH] aio: avoid using queue_delayed_work in aio_kick_handler to schedule itself Nikanth Karthikesan
@ 2008-06-27 13:11 ` Jeff Moyer
2008-06-30 5:50 ` Nikanth Karthikesan
0 siblings, 1 reply; 5+ messages in thread
From: Jeff Moyer @ 2008-06-27 13:11 UTC (permalink / raw)
To: Nikanth Karthikesan; +Cc: linux-aio, linux-kernel, Benjamin LaHaise, Zach Brown
Nikanth Karthikesan <knikanth@suse.de> writes:
> Avoid using queue_delayed_work in aio_kick_handler() to run itself
> immediately. Instead use aio_run_all_iocbs()
Can you give some rationale for this change? Also, how did you test it?
Cheers,
Jeff
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] aio: avoid using queue_delayed_work in aio_kick_handler to schedule itself
2008-06-27 13:11 ` Jeff Moyer
@ 2008-06-30 5:50 ` Nikanth Karthikesan
2008-07-01 8:51 ` Nikanth Karthikesan
0 siblings, 1 reply; 5+ messages in thread
From: Nikanth Karthikesan @ 2008-06-30 5:50 UTC (permalink / raw)
To: Jeff Moyer; +Cc: linux-aio, linux-kernel, Benjamin LaHaise, Zach Brown
On Friday 27 June 2008 18:41:37 Jeff Moyer wrote:
> Nikanth Karthikesan <knikanth@suse.de> writes:
> > Avoid using queue_delayed_work in aio_kick_handler() to run itself
> > immediately. Instead use aio_run_all_iocbs()
>
> Can you give some rationale for this change? Also, how did you test it?
>
The comment in aio_kick_handler(), "we're in a worker thread already, don't
use queue_delayed_work" triggered me to do this. Ran multiple instances
of Stephen Hemminger's aio cp for basic testing.
I think this would make it unfair between different kioctx? May be only the
comment should be removed?
Thanks
Nikanth Karthikesan
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] aio: avoid using queue_delayed_work in aio_kick_handler to schedule itself
2008-06-30 5:50 ` Nikanth Karthikesan
@ 2008-07-01 8:51 ` Nikanth Karthikesan
2008-07-07 13:44 ` Chris Mason
0 siblings, 1 reply; 5+ messages in thread
From: Nikanth Karthikesan @ 2008-07-01 8:51 UTC (permalink / raw)
To: Jeff Moyer; +Cc: linux-aio, linux-kernel, Benjamin LaHaise, Zach Brown
On Monday 30 June 2008 11:20:27 Nikanth Karthikesan wrote:
> On Friday 27 June 2008 18:41:37 Jeff Moyer wrote:
> > Nikanth Karthikesan <knikanth@suse.de> writes:
> > > Avoid using queue_delayed_work in aio_kick_handler() to run itself
> > > immediately. Instead use aio_run_all_iocbs()
> >
> > Can you give some rationale for this change? Also, how did you test it?
>
> The comment in aio_kick_handler(), "we're in a worker thread already, don't
> use queue_delayed_work" triggered me to do this. Ran multiple instances
> of Stephen Hemminger's aio cp for basic testing.
>
> I think this would make it unfair between different kioctx? May be only the
> comment should be removed?
>
Anyway we are scheduling it again with timeout of 0, so fairness shouldnt be a
problem? If yes, wouldn't this change reduce the overhead of queuing the work
again, and repeated lock/unlock.
Thanks
Nikanth Karthikesan
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] aio: avoid using queue_delayed_work in aio_kick_handler to schedule itself
2008-07-01 8:51 ` Nikanth Karthikesan
@ 2008-07-07 13:44 ` Chris Mason
0 siblings, 0 replies; 5+ messages in thread
From: Chris Mason @ 2008-07-07 13:44 UTC (permalink / raw)
To: Nikanth Karthikesan
Cc: Jeff Moyer, linux-aio, linux-kernel, Benjamin LaHaise, Zach Brown
On Tue, 2008-07-01 at 14:21 +0530, Nikanth Karthikesan wrote:
> On Monday 30 June 2008 11:20:27 Nikanth Karthikesan wrote:
> > On Friday 27 June 2008 18:41:37 Jeff Moyer wrote:
> > > Nikanth Karthikesan <knikanth@suse.de> writes:
> > > > Avoid using queue_delayed_work in aio_kick_handler() to run itself
> > > > immediately. Instead use aio_run_all_iocbs()
> > >
> > > Can you give some rationale for this change? Also, how did you test it?
> >
> > The comment in aio_kick_handler(), "we're in a worker thread already, don't
> > use queue_delayed_work" triggered me to do this. Ran multiple instances
> > of Stephen Hemminger's aio cp for basic testing.
> >
> > I think this would make it unfair between different kioctx? May be only the
> > comment should be removed?
> >
>
> Anyway we are scheduling it again with timeout of 0, so fairness shouldnt be a
> problem? If yes, wouldn't this change reduce the overhead of queuing the work
> again, and repeated lock/unlock.
The main purpose of the delayed queuing was to improve performance with
workloads where the work was more or less immediately done. The best
example is aio pipes. The delayed queue cut down on the context switch
rate dramatically and made a large performance improvement for pipe
workloads (without cutting down on other perf at the time).
-chris
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2008-07-07 13:46 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-26 3:57 [PATCH] aio: avoid using queue_delayed_work in aio_kick_handler to schedule itself Nikanth Karthikesan
2008-06-27 13:11 ` Jeff Moyer
2008-06-30 5:50 ` Nikanth Karthikesan
2008-07-01 8:51 ` Nikanth Karthikesan
2008-07-07 13:44 ` Chris Mason
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox