From 92327d289b993313eee82fac29b847776f6e621a Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Sun, 18 Jan 2004 18:26:43 -0800 Subject: [PATCH] [PATCH] AS: thinktime improvement From: Nick Piggin Sometimes a processes thinktime shouldn't be measured on how soon it submits its next request, but how soon any close request is submitted. Some processes, such as those in make -j, find | xargs blah, etc. Should be waited upon even if they never submit another request, because they work with cooperating or child processes. This helps to take that into account. --- drivers/block/as-iosched.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/block/as-iosched.c b/drivers/block/as-iosched.c index 6ce25f248dadc..8b90600955317 100644 --- a/drivers/block/as-iosched.c +++ b/drivers/block/as-iosched.c @@ -657,6 +657,7 @@ static int as_close_req(struct as_data *ad, struct as_rq *arq) return (last - (delta>>1) <= next) && (next <= last + delta); } +static void as_update_thinktime(struct as_data *ad, struct as_io_context *aic, unsigned long ttime); /* * as_can_break_anticipation returns true if we have been anticipating this * request. @@ -686,6 +687,15 @@ static int as_can_break_anticipation(struct as_data *ad, struct as_rq *arq) if (arq && arq->is_sync == REQ_SYNC && as_close_req(ad, arq)) { /* close request */ + struct as_io_context *aic = ioc->aic; + if (aic) { + unsigned long thinktime; + spin_lock(&aic->lock); + thinktime = jiffies - aic->last_end_request; + aic->last_end_request = jiffies; + as_update_thinktime(ad, aic, thinktime); + spin_unlock(&aic->lock); + } return 1; } -- 2.53.0