From: "Jan Beulich" Subject: [PATCH] linux-2.6.18/scsiback: don't let in-flight requests defer pending ones Date: Thu, 22 Nov 2012 12:20:11 +0000 Message-ID: <50AE268B02000078000AA952@nat28.tlf.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__PartE5D4166B.0__=" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel List-Id: xen-devel@lists.xenproject.org This is a MIME message. If you are reading this text, you may want to consider changing to a mail reader or gateway that understands how to properly handle MIME multipart messages. --=__PartE5D4166B.0__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Running RING_FINAL_CHECK_FOR_REQUESTS from make_response is a bad idea. It means that in-flight I/O is essentially blocking continued batches. This essentially kills throughput on frontends which unplug (or even just notify) early and rightfully assume additional requests will be picked up on time, not synchronously. Derived from a similar blkback patch by Daniel Stodden (see c/s 1118:c7c14595c18b). Signed-off-by: Jan Beulich --- a/drivers/xen/scsiback/scsiback.c +++ b/drivers/xen/scsiback/scsiback.c @@ -149,7 +149,6 @@ void scsiback_do_resp_with_sense(char *s vscsiif_response_t *ring_res; struct vscsibk_info *info =3D pending_req->info; int notify; - int more_to_do =3D 1; struct scsi_sense_hdr sshdr; unsigned long flags; =20 @@ -182,17 +181,8 @@ void scsiback_do_resp_with_sense(char *s ring_res->residual_len =3D resid; =20 RING_PUSH_RESPONSES_AND_CHECK_NOTIFY(&info->ring, notify); - if (info->ring.rsp_prod_pvt =3D=3D info->ring.req_cons) { - RING_FINAL_CHECK_FOR_REQUESTS(&info->ring, more_to_do); - } else if (RING_HAS_UNCONSUMED_REQUESTS(&info->ring)) { - more_to_do =3D 1; - } -=09 spin_unlock_irqrestore(&info->ring_lock, flags); =20 - if (more_to_do) - scsiback_notify_work(info); - if (notify) notify_remote_via_irq(info->irq); =20 @@ -586,7 +576,7 @@ invalid_value: } =20 =20 -static int scsiback_do_cmd_fn(struct vscsibk_info *info) +static int _scsiback_do_cmd_fn(struct vscsibk_info *info) { struct vscsiif_back_ring *ring =3D &info->ring; vscsiif_request_t *ring_req; @@ -652,6 +642,21 @@ static int scsiback_do_cmd_fn(struct vsc return more_to_do; } =20 +static int scsiback_do_cmd_fn(struct vscsibk_info *info) +{ + int more_to_do; + + do { + more_to_do =3D _scsiback_do_cmd_fn(info); + if (more_to_do) + break; + + RING_FINAL_CHECK_FOR_REQUESTS(&info->ring, more_to_do); + } while (more_to_do); + + return more_to_do; +} + =20 int scsiback_schedule(void *data) { --=__PartE5D4166B.0__= Content-Type: text/plain; name="xen-scsiback-streamline.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="xen-scsiback-streamline.patch" scsiback: don't let in-flight requests defer pending ones=0A=0ARunning = RING_FINAL_CHECK_FOR_REQUESTS from make_response is a bad=0Aidea. It means = that in-flight I/O is essentially blocking continued=0Abatches. This = essentially kills throughput on frontends which unplug=0A(or even just = notify) early and rightfully assume additional requests=0Awill be picked = up on time, not synchronously.=0A=0ADerived from a similar blkback patch = by Daniel Stodden (see c/s=0A1118:c7c14595c18b).=0A=0ASigned-off-by: Jan = Beulich =0A=0A--- a/drivers/xen/scsiback/scsiback.c=0A++= + b/drivers/xen/scsiback/scsiback.c=0A@@ -149,7 +149,6 @@ void scsiback_do_= resp_with_sense(char *s=0A vscsiif_response_t *ring_res;=0A = struct vscsibk_info *info =3D pending_req->info;=0A int notify;=0A- = int more_to_do =3D 1;=0A struct scsi_sense_hdr sshdr;=0A = unsigned long flags;=0A =0A@@ -182,17 +181,8 @@ void scsiback_do_resp_with_= sense(char *s=0A ring_res->residual_len =3D resid;=0A =0A = RING_PUSH_RESPONSES_AND_CHECK_NOTIFY(&info->ring, notify);=0A- if = (info->ring.rsp_prod_pvt =3D=3D info->ring.req_cons) {=0A- = RING_FINAL_CHECK_FOR_REQUESTS(&info->ring, more_to_do);=0A- } else if = (RING_HAS_UNCONSUMED_REQUESTS(&info->ring)) {=0A- more_to_do = =3D 1;=0A- }=0A- =0A spin_unlock_irqrestore(&info->ring_lock, = flags);=0A =0A- if (more_to_do)=0A- scsiback_notify_work(info);= =0A-=0A if (notify)=0A notify_remote_via_irq(info->irq);= =0A =0A@@ -586,7 +576,7 @@ invalid_value:=0A }=0A =0A =0A-static int = scsiback_do_cmd_fn(struct vscsibk_info *info)=0A+static int _scsiback_do_cm= d_fn(struct vscsibk_info *info)=0A {=0A struct vscsiif_back_ring = *ring =3D &info->ring;=0A vscsiif_request_t *ring_req;=0A@@ -652,6 = +642,21 @@ static int scsiback_do_cmd_fn(struct vsc=0A return more_to_do;= =0A }=0A =0A+static int scsiback_do_cmd_fn(struct vscsibk_info *info)=0A+{= =0A+ int more_to_do;=0A+=0A+ do {=0A+ more_to_do =3D = _scsiback_do_cmd_fn(info);=0A+ if (more_to_do)=0A+ = break;=0A+=0A+ RING_FINAL_CHECK_FOR_REQUESTS(&info->ring, = more_to_do);=0A+ } while (more_to_do);=0A+=0A+ return more_to_do;= =0A+}=0A+=0A =0A int scsiback_schedule(void *data)=0A {=0A --=__PartE5D4166B.0__= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel --=__PartE5D4166B.0__=--