From patchwork Thu May 31 13:23:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Valente X-Patchwork-Id: 137388 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp6599886lji; Thu, 31 May 2018 06:23:43 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJrw6WbN91/2/retkzS+AhqkBClD18MiAdyNimVIbfnjqV5Ff5RcnYCZIyPzPvX7Cgzb7Mc X-Received: by 2002:a62:1083:: with SMTP id 3-v6mr6798354pfq.229.1527773023502; Thu, 31 May 2018 06:23:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527773023; cv=none; d=google.com; s=arc-20160816; b=LBMAbUFQFS81wV5YrbVHzWwS+OeUjsKxWqwCvAQxwtlF6KgvieyEhUwXjX+aJO0oRc BYsezMHl4E38kEZrjS59GrnJoOQalHQVoePjTGrVJg63HNrHVcWVKmooFSGcDzebLbRT tOn+/PGZdMvRLkImwezV9vf+dF0w5J0IwwPWAWs6HjzwDa4RVhsLGB8sHOucleGpOATH IaqumssRHJv6PZZN59FZMGVTEhq0YNxqoax6UoHUpm2qKEagA1i6ZettNWBbzzTdd2Wb om41IEuAGmx4evSYlDavW/72O8uv33HQpzcAnbxKjWeKWeugBjGw0T7W5HsPqhVEcX3R XlbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=PoqjbBYW1Eiq6YTf8CzxmL3H/N7hXTcZfnLA2waIqAQ=; b=gi8tWCW2SHu9jI3hr5mvufaGDj8ArCaOaVCwmA/TjfJ+WeZRLFczx6gs5aChe7OWj0 AOr69ttpWqHPFfVECkPpw9yz+wCWGutVtxASl1e6Z7R6M6iwGka4LaPjdIA5HjL8hZiv 1jZSKorLDNveriVMpWs80yQM+X9bePVnUw/OVqg2dS9YD7Pk7PQg7ioWoq7//bIXIaP5 a0nRCY/AKwXzUUQSkeVnl5E8o5VFk5yavvMUuPxno/p94cYoxNYgQorlNKXZUISb92NI jpfNb9SMI8KowCqJonQGQEJW/fPTcXe5VJ1ENnt4LipiUZuPpoiHh0MYdgvwpc439eH3 gUEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=D/d9jfzE; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r17-v6si17558609pls.597.2018.05.31.06.23.43; Thu, 31 May 2018 06:23:43 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=D/d9jfzE; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755291AbeEaNXk (ORCPT + 30 others); Thu, 31 May 2018 09:23:40 -0400 Received: from mail-wr0-f196.google.com ([209.85.128.196]:40940 "EHLO mail-wr0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755159AbeEaNXf (ORCPT ); Thu, 31 May 2018 09:23:35 -0400 Received: by mail-wr0-f196.google.com with SMTP id l41-v6so33047084wre.7 for ; Thu, 31 May 2018 06:23:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=PoqjbBYW1Eiq6YTf8CzxmL3H/N7hXTcZfnLA2waIqAQ=; b=D/d9jfzEs1AkewG3qYsCo02M6AkabcFZjfpw2gd8fNLEruK6oHRGwgu8gu6mXotQcz jaTUJSEtivjoEjggSuVgMvqgLF35ATqpiFZsnxCY0bUbs8bqoYNsNZvFLXvYW7GGsP12 hHDmfcMxgisg2U3XZ9/0SiVD46rC02MnblgXk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=PoqjbBYW1Eiq6YTf8CzxmL3H/N7hXTcZfnLA2waIqAQ=; b=Ajifsv70TTiXlQ2G5owhITZEfDFTN/ZA+3IOubqyPYz3JfhZVkl3ORawnYI85vgVZW C8vmI85sD1ZX8QPwLfoMSq6G4sKDxTwEdzHncC+wEama1K8Dx3c0LK5KLpC8oZ1w8TNQ LqvztBPKD3NZ5JGo2GYBGYVQDrJm5/RNnyvFfWALbJ0pefYLvl/8P+lcjygkdKCPSBK9 65PJWDGzl9GIK2AHwJIBPQ8iCjTDjhnmWuVfQxHjLPb58WlsPFQS3QeHyRGAq0YTVrMW eD4IdVgSY2svrhCsQd8N+fb/6mPEsZpB/0OEc8d1/aMjMfu8Of2t9Jt4g8sabxuBfgvq MqLA== X-Gm-Message-State: ALKqPwfDlBVJCrW6DhFyvniz6cNz4G0Ci0FR36sWTFLBKkz8u+eRqaM6 q3jvgijNH6wO+GZGbamArIKjWw== X-Received: by 2002:a5d:408f:: with SMTP id o15-v6mr4921225wrp.133.1527773013252; Thu, 31 May 2018 06:23:33 -0700 (PDT) Received: from localhost.localdomain (146-241-12-84.dyn.eolo.it. [146.241.12.84]) by smtp.gmail.com with ESMTPSA id e133-v6sm1759478wma.38.2018.05.31.06.23.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 31 May 2018 06:23:31 -0700 (PDT) From: Paolo Valente To: Jens Axboe Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, ulf.hansson@linaro.org, broonie@kernel.org, linus.walleij@linaro.org, bfq-iosched@googlegroups.com, oleksandr@natalenko.name, filippo.muzzini@outlook.it, Paolo Valente Subject: [PATCH BUGFIX 1/3] block, bfq: remove wrong lock in bfq_requests_merged Date: Thu, 31 May 2018 15:23:11 +0200 Message-Id: <20180531132313.2986-2-paolo.valente@linaro.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180531132313.2986-1-paolo.valente@linaro.org> References: <20180531132313.2986-1-paolo.valente@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Filippo Muzzini In bfq_requests_merged(), there is a deadlock because the lock on bfqq->bfqd->lock is held by the calling function, but the code of this function tries to grab the lock again. This deadlock is currently hidden by another bug (fixed by next commit for this source file), which causes the body of bfq_requests_merged() to be never executed. This commit removes the deadlock by removing the lock/unlock pair. Signed-off-by: Filippo Muzzini Signed-off-by: Paolo Valente --- block/bfq-iosched.c | 2 -- 1 file changed, 2 deletions(-) -- 2.16.1 diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c index 771ae9730ac6..1f0951d36424 100644 --- a/block/bfq-iosched.c +++ b/block/bfq-iosched.c @@ -1898,7 +1898,6 @@ static void bfq_requests_merged(struct request_queue *q, struct request *rq, if (!RB_EMPTY_NODE(&rq->rb_node)) goto end; - spin_lock_irq(&bfqq->bfqd->lock); /* * If next and rq belong to the same bfq_queue and next is older @@ -1923,7 +1922,6 @@ static void bfq_requests_merged(struct request_queue *q, struct request *rq, bfq_remove_request(q, next); bfqg_stats_update_io_remove(bfqq_group(bfqq), next->cmd_flags); - spin_unlock_irq(&bfqq->bfqd->lock); end: bfqg_stats_update_io_merged(bfqq_group(bfqq), next->cmd_flags); } From patchwork Thu May 31 13:23:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Valente X-Patchwork-Id: 137389 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp6599915lji; Thu, 31 May 2018 06:23:45 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLPu6rHiJcoiAl6F3JbUokFXsAx8PcDRPKnioGoDX7+oZkYLdFCn7a3hChGkAm5GttC67/Q X-Received: by 2002:a17:902:8685:: with SMTP id g5-v6mr6844233plo.302.1527773025683; Thu, 31 May 2018 06:23:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527773025; cv=none; d=google.com; s=arc-20160816; b=H4GrOAhEOECO1ErwR/WW0rgtHUfD9UJEFQG4POsYlwDIEjZR+dNLFL7f5GOWHo8VKJ AmoWpuV/C70k8uP3lfQhPcvIT2cb5wlUTCdiuEss76yiPxsVCtlSzJt+SfpTP6o0ZwEt EAYv8nqNCuqAUuMPbyoSRFO6flMvoZw2naVjqfMuSw47kDYVs0+dSIKEeRNLE04ALBNb 8apEzvs2FvaMrDv7NA1ik7Srq6Mi+iWaa+4JPkr4+oAwmQ9WpeNXDQhmm97/kZKPXTKP QFXQXxOl8X4bilTWv0h9GzKiunZDZJJ42GZX2IpfNFOd59KWjBse/+kelTSZKJ109GqO AiKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=EDxxfeUlzKc3ZdpNXUqSJs2cf7e+TOKIjiRlTJbaC3c=; b=D0JEDurfPq4j4AXaTZo6oObKXSdgiNHRAlz/scKMdUz91VMJHA9aFm46qmlB2L/os7 ykpy7nOTiehln6M8e4EpSoV44zTLUe8Bjfk6Zbin42bAwLFTDLiWZT5cVwZUUjQoW67J QIVlulBg4ty4SSuNQ6QhCnfiOJGNzV3zjFHTWU05vVTWe+wKTWSvy0mNf38/6iZFqYBR 3mEPjTMPB79TODKE7MlZrQPuOXhm4hIQvs1KaBSXbNnw/VZai2dm4ys6hw04cMFCDbkJ z3+Ad3UQX8jw+F5uEaDRSL4K08qMVop/Z/H2C4ng3hQqI7xxvUQfvgYotV7ScpXgXDo/ GogA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ktD10YBc; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r17-v6si17558609pls.597.2018.05.31.06.23.45; Thu, 31 May 2018 06:23:45 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ktD10YBc; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755304AbeEaNXn (ORCPT + 30 others); Thu, 31 May 2018 09:23:43 -0400 Received: from mail-wr0-f194.google.com ([209.85.128.194]:41183 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755267AbeEaNXf (ORCPT ); Thu, 31 May 2018 09:23:35 -0400 Received: by mail-wr0-f194.google.com with SMTP id u12-v6so32975529wrn.8 for ; Thu, 31 May 2018 06:23:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=EDxxfeUlzKc3ZdpNXUqSJs2cf7e+TOKIjiRlTJbaC3c=; b=ktD10YBcp5E8ciX+3S5pI3WjJnM6xxQXu0WgI6vyFWNTOYz5LV9GEoGHkXiwZoF0Ie 2cetWMyW/dOIkOlMop3xzbFkctPqT+igg8/RToL0AdTgjktbRERMJmW9iq6Th700/IUx TbIUHvZXagH9GYrUKGS29ldj4fsrzLNWHCs8s= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=EDxxfeUlzKc3ZdpNXUqSJs2cf7e+TOKIjiRlTJbaC3c=; b=fwe/RKUinL9HjWaumhrYAD0GZydFYGNRRGmraZMvk/gPddgnrnDPXu+W+h/VPRnroM 3p+3jRyolbgbr+nVM99Z4yd6Sa4WOqh85HsBBN2T3ndIh7rbiwAoi0xvvpkbAQ84F+eX ZnCo1G1nI4ABPZY2Syt0FKWdy3rhwW2D1k7yz8WrGhzC3wkwJAyzU8suAUvqYvoMMGFy gANYc2e++hCD4pfEpUmov8nh0W6G1a/wUQsIDuD3HBv3tzfyX5lQ7z0zT40Ukh2wWHeI S/V7Moth+vrbJxOlpStt5pGmJPRgNphrdxoCZ5ZMZoxiOd3m2F5bfAVrR9kRmNDaLIM9 7Nfg== X-Gm-Message-State: ALKqPwdnvYTIXpeK21Skl3J2TbZGLSJvW2In46LcyA9bQQRSRtFGpRqn 1BCvNm5mNvddecL/JTV6W0+bVw== X-Received: by 2002:adf:8290:: with SMTP id 16-v6mr5346141wrc.38.1527773014580; Thu, 31 May 2018 06:23:34 -0700 (PDT) Received: from localhost.localdomain (146-241-12-84.dyn.eolo.it. [146.241.12.84]) by smtp.gmail.com with ESMTPSA id e133-v6sm1759478wma.38.2018.05.31.06.23.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 31 May 2018 06:23:33 -0700 (PDT) From: Paolo Valente To: Jens Axboe Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, ulf.hansson@linaro.org, broonie@kernel.org, linus.walleij@linaro.org, bfq-iosched@googlegroups.com, oleksandr@natalenko.name, filippo.muzzini@outlook.it, Paolo Valente Subject: [PATCH BUGFIX 2/3] block, bfq: remove wrong check in bfq_requests_merged Date: Thu, 31 May 2018 15:23:12 +0200 Message-Id: <20180531132313.2986-3-paolo.valente@linaro.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180531132313.2986-1-paolo.valente@linaro.org> References: <20180531132313.2986-1-paolo.valente@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The request rq passed to the function bfq_requests_merged is always in a bfq_queue, so the check !RB_EMPTY_NODE(&rq->rb_node) at the beginning of bfq_requests_merged always succeeds, and the control flow systematically skips to the end of the function. This implies that the body of the function is never executed, i.e., the repositioning of rq is never performed. On the opposite end, a control is missing in the body of the function: 'next' must be removed only if it is inside a bfq_queue. This commit removes the wrong check on rq, and adds the missing check on 'next'. In addition, this commit adds comments on bfq_requests_merged. Signed-off-by: Filippo Muzzini Signed-off-by: Paolo Valente --- block/bfq-iosched.c | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) -- 2.16.1 diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c index 1f0951d36424..df2a9633cf4a 100644 --- a/block/bfq-iosched.c +++ b/block/bfq-iosched.c @@ -1891,14 +1891,27 @@ static void bfq_request_merged(struct request_queue *q, struct request *req, } } +/* + * This function is called to notify the scheduler that the requests + * rq and 'next' have been merged, with 'next' going away. BFQ + * exploits this hook to address the following issue: if 'next' has a + * fifo_time lower that rq, then the fifo_time of rq must be set to + * the value of 'next', to not forget the greater age of 'next'. + * Moreover 'next' may be in a bfq_queue, in this case it must be + * removed. + * + * NOTE: in this function we assume that rq is in a bfq_queue, basing + * on that rq is picked from the hash table q->elevator->hash, which, + * in its turn, is filled only with I/O requests present in + * bfq_queues, while BFQ is in use for the request queue q. In fact, + * the function that fills this hash table (elv_rqhash_add) is called + * only by bfq_insert_request. + */ static void bfq_requests_merged(struct request_queue *q, struct request *rq, struct request *next) { struct bfq_queue *bfqq = RQ_BFQQ(rq), *next_bfqq = RQ_BFQQ(next); - if (!RB_EMPTY_NODE(&rq->rb_node)) - goto end; - /* * If next and rq belong to the same bfq_queue and next is older * than rq, then reposition rq in the fifo (by substituting next @@ -1919,10 +1932,11 @@ static void bfq_requests_merged(struct request_queue *q, struct request *rq, if (bfqq->next_rq == next) bfqq->next_rq = rq; - bfq_remove_request(q, next); - bfqg_stats_update_io_remove(bfqq_group(bfqq), next->cmd_flags); + if (!RB_EMPTY_NODE(&next->rb_node)) { + bfq_remove_request(q, next); + bfqg_stats_update_io_remove(bfqq_group(bfqq), next->cmd_flags); + } -end: bfqg_stats_update_io_merged(bfqq_group(bfqq), next->cmd_flags); } From patchwork Thu May 31 13:23:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Valente X-Patchwork-Id: 137390 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp6600271lji; Thu, 31 May 2018 06:24:06 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKPr+Aa7QuB7ylx47tlL6RXoRAaZaXmBNQpDIymUCVyxTBGrB+4JpHeCEn/RhELPaj04JeX X-Received: by 2002:a17:902:6e08:: with SMTP id u8-v6mr6914142plk.96.1527773046311; Thu, 31 May 2018 06:24:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527773046; cv=none; d=google.com; s=arc-20160816; b=Rg9I/94GmjJ9zdGVwHgbvxGn7idtybArh3iBeXPwt89/ulnK47wRhpApOGSNNO+1L5 lWQjmMXvu6qSVkvee4pnZZvy5tqucA1jGIVJLFKN4w0hpXQD2KnJM9sYsT2jwR/xxOnJ 5ewTHByNDD0Aj6CHPSK2dTpzSAiNFCL0pr92nyd2Y7aS3ggUSoDmJriff75gy2jbhI2d TY8YVOtGtmCVsDjsGn+5Xi0qQc+KvoX+AhE+4X29AjGP3a5LQB8zCnTbOy2oAOycVY9Y /lEyxWS3tOI0PiixwNn7A2QiuTd7oz07vCIJgRDeL4fi1LDC1gyPalJP7pEdq6I0j3WJ bCcw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=SEqMJfUIX3kP85UUaY/w/+7NvrfkRE9rpolvb0MZdLo=; b=NQTpin6U+dGnXMrKJaW7k+erY/b5Zh4YVlR7EThQBcCN6gd+5GpenGFBnaEcKVTMur p8pYozbNn49bNzufrtPRqYJd9XdRmk9dbhllPq29nxek4X2udmu8quALRzQu7D5VexvS wZWez6SUoW9zOcj1/q9fCE79xqkVU1HpybK6jNZ75am6XzuyBYgaJn61hBOurTplys3R dQCk8xPDAWQl9cdIKrQXrIyMsgIQI+1g8g9I3GkHcTiaQvQDa+QhgAOMDwFLQs3O7hX5 62OpFbMvKa30e0PU6+XWe15j2fOHKi88Kswo/6DGspJ7vgAHjHINK0JrjoTOv+iLb2Kp svQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Zpi40Vqy; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s24-v6si35432385pfm.257.2018.05.31.06.24.05; Thu, 31 May 2018 06:24:06 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Zpi40Vqy; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755322AbeEaNYE (ORCPT + 30 others); Thu, 31 May 2018 09:24:04 -0400 Received: from mail-wr0-f196.google.com ([209.85.128.196]:36532 "EHLO mail-wr0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755234AbeEaNXi (ORCPT ); Thu, 31 May 2018 09:23:38 -0400 Received: by mail-wr0-f196.google.com with SMTP id f16-v6so17680097wrm.3 for ; Thu, 31 May 2018 06:23:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=SEqMJfUIX3kP85UUaY/w/+7NvrfkRE9rpolvb0MZdLo=; b=Zpi40VqynHhcXX0OPsnwgYap8+YEDVkpn5LRF9gAqxvyU9btcM66JJwL8mYDxjEEFR MsgerSMn9KAkJZg1NH8SK0B97a1u0okKAWU1/7z43nVBIDapLEq2gOQvft2Ey8qGr4gq F6rS1xY0nfeNgoN3BTgfoMnmaKnpUwBb8aNB8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=SEqMJfUIX3kP85UUaY/w/+7NvrfkRE9rpolvb0MZdLo=; b=VfgpyO/ifmSOTvuUJP5YErMlYh42vgs7Ncra6Pa0atJHvBIPRyYcicdyfD2NNcztGD yCmjesasPWdp8o5iQ4cP9mqCw6nO5styFFSk6UNyKcIBEnDgA2hev49ZI6idK0e/vpOi 1LyNkcoOhGXNI203kJRLpAqnYfDQBNtRpRdC5F+4QvOLCvqGIKsuzJyo2T4ARrn8xofM bpgKi6SAQ+VbM+l7ebw3DmmEiVLPcox+We/ZoVBYhRev+wASMQOTrDl5rQ9FV6dgyk8n 7HAIYJc/lvXCBjiuzVlKDN0QpVuvmoAq1nkuqjSBL5Id6ev9/mUiVMUL9ZSZ2GBDEzrW zC3A== X-Gm-Message-State: ALKqPwfnscMNX4JwuwJl5C7x6X7BXJFyW9hUGWlzhulY8kdrSyhXX2N1 qkn4jy7WXW41mP2gxjvrPXzbZwFh+Qc= X-Received: by 2002:adf:891a:: with SMTP id s26-v6mr5133200wrs.276.1527773017025; Thu, 31 May 2018 06:23:37 -0700 (PDT) Received: from localhost.localdomain (146-241-12-84.dyn.eolo.it. [146.241.12.84]) by smtp.gmail.com with ESMTPSA id e133-v6sm1759478wma.38.2018.05.31.06.23.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 31 May 2018 06:23:35 -0700 (PDT) From: Paolo Valente To: Jens Axboe Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, ulf.hansson@linaro.org, broonie@kernel.org, linus.walleij@linaro.org, bfq-iosched@googlegroups.com, oleksandr@natalenko.name, filippo.muzzini@outlook.it, Paolo Valente Subject: [PATCH BUGFIX 3/3] block, bfq: remove the removal of 'next' rq in bfq_requests_merged Date: Thu, 31 May 2018 15:23:13 +0200 Message-Id: <20180531132313.2986-4-paolo.valente@linaro.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180531132313.2986-1-paolo.valente@linaro.org> References: <20180531132313.2986-1-paolo.valente@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Filippo Muzzini Since bfq_finish_request() is always called on the request 'next', after bfq_requests_merged() is finished, and bfq_finish_request() removes 'next' from its bfq_queue if needed, it isn't necessary to do such a removal in advance in bfq_merged_requests(). This commit removes such a useless 'next' removal. Signed-off-by: Filippo Muzzini Signed-off-by: Paolo Valente --- block/bfq-iosched.c | 7 ------- 1 file changed, 7 deletions(-) -- 2.16.1 diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c index df2a9633cf4a..f71a5846b629 100644 --- a/block/bfq-iosched.c +++ b/block/bfq-iosched.c @@ -1897,8 +1897,6 @@ static void bfq_request_merged(struct request_queue *q, struct request *req, * exploits this hook to address the following issue: if 'next' has a * fifo_time lower that rq, then the fifo_time of rq must be set to * the value of 'next', to not forget the greater age of 'next'. - * Moreover 'next' may be in a bfq_queue, in this case it must be - * removed. * * NOTE: in this function we assume that rq is in a bfq_queue, basing * on that rq is picked from the hash table q->elevator->hash, which, @@ -1932,11 +1930,6 @@ static void bfq_requests_merged(struct request_queue *q, struct request *rq, if (bfqq->next_rq == next) bfqq->next_rq = rq; - if (!RB_EMPTY_NODE(&next->rb_node)) { - bfq_remove_request(q, next); - bfqg_stats_update_io_remove(bfqq_group(bfqq), next->cmd_flags); - } - bfqg_stats_update_io_merged(bfqq_group(bfqq), next->cmd_flags); }