From patchwork Fri Mar 29 21:59:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trond Myklebust X-Patchwork-Id: 10877761 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E97D51575 for ; Fri, 29 Mar 2019 22:02:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D4AD2292AC for ; Fri, 29 Mar 2019 22:02:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C9145292B2; Fri, 29 Mar 2019 22:02:05 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6B073292B4 for ; Fri, 29 Mar 2019 22:02:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730144AbfC2WCE (ORCPT ); Fri, 29 Mar 2019 18:02:04 -0400 Received: from mail-it1-f194.google.com ([209.85.166.194]:38945 "EHLO mail-it1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730303AbfC2WCE (ORCPT ); Fri, 29 Mar 2019 18:02:04 -0400 Received: by mail-it1-f194.google.com with SMTP id 139so6260273ita.4 for ; Fri, 29 Mar 2019 15:02:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=byabvxxmICV7URMFFD2mJ+S6tFfR9tedVIX8kLsaKcA=; b=RHTat0YjsHIW9mm+HVbrMn5Cvexzk1aUDokUt81AZHukBh/RiDnuMdy8BQBlRUAnMf O9WEJkFI2k7UKPGZ0kDNkaRBZdZi1Ng0w//QvRxDpsM+X3RckJ3UcESmRVX91C5aBERB cyMRL7cGlyDezOunNxEBWv6iUfbEciaJiEan4r3Y2vrnvA/uDFN8BCd9WYcz7+KTkvXV GyF0vFQGPr6vpN33atRQ24Kny89GzwOdhy5PFUdK5gRn2tu+3fdyxGZmrS7R/CjFIPg7 yamHLbWjyUqZyGXjfpc2nQ8runUAlzUyG8iacggmngaWcXXiVJ4kpFZ5AzbFgdj4d6gs XTQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=byabvxxmICV7URMFFD2mJ+S6tFfR9tedVIX8kLsaKcA=; b=pTmjpis3ZNu7yIMi4Jv2Rm0Qa3b29m0sHzuBVjQ3o2XeMUAAwZqy00aeimtGS3/J3N 9FgCTCsP0HttumnIfXeqQ9Wf/FGpA0F3qyHNmLY4h7pDfrM0fF+NhLPPS/a+a+Pkgy0j hBQlvKJrPvNarqI6L0P7300ptR7lVJ8apWompAM8JDvn4nDTFBzehsHbnGD6BGLjhUk3 6N5QSzm/vM/bK5GJU/0dNas5rL919NrjGIS6FWwcfcrVrm89AsyIjiEMvL1GErFWjEMh kFXQ+c6DMgIzQv0o78PIzn9UI1jcL63sZHq+qkzpl4nLlv8s/CwZRLcog0t1FZ0oASQ3 krHA== X-Gm-Message-State: APjAAAUwGkX2+4a3NIsgPMaMqezNaeRBq04926RN4DNmJir4ZAlbC/1K AdM7RXHZMPhX5TjrSF7FOiPGovc= X-Google-Smtp-Source: APXvYqxOOYuvUScZ8cGa4ptvJIZ8cQy27FZ4ObhSJDPmIoZ+QZD4N3XJj49L3CXPZq+RCaQue7cwvQ== X-Received: by 2002:a05:6638:61a:: with SMTP id g26mr3905730jar.83.1553896922886; Fri, 29 Mar 2019 15:02:02 -0700 (PDT) Received: from localhost.localdomain (c-68-40-189-247.hsd1.mi.comcast.net. [68.40.189.247]) by smtp.gmail.com with ESMTPSA id v20sm1376796ioh.17.2019.03.29.15.02.02 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 29 Mar 2019 15:02:02 -0700 (PDT) From: Trond Myklebust X-Google-Original-From: Trond Myklebust To: linux-nfs@vger.kernel.org Subject: [PATCH v2 08/28] SUNRPC: Simplify queue timeouts using timer_reduce() Date: Fri, 29 Mar 2019 17:59:28 -0400 Message-Id: <20190329215948.107328-9-trond.myklebust@hammerspace.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190329215948.107328-8-trond.myklebust@hammerspace.com> References: <20190329215948.107328-1-trond.myklebust@hammerspace.com> <20190329215948.107328-2-trond.myklebust@hammerspace.com> <20190329215948.107328-3-trond.myklebust@hammerspace.com> <20190329215948.107328-4-trond.myklebust@hammerspace.com> <20190329215948.107328-5-trond.myklebust@hammerspace.com> <20190329215948.107328-6-trond.myklebust@hammerspace.com> <20190329215948.107328-7-trond.myklebust@hammerspace.com> <20190329215948.107328-8-trond.myklebust@hammerspace.com> MIME-Version: 1.0 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Simplify the setting of queue timeouts by using the timer_reduce() function. Signed-off-by: Trond Myklebust --- include/linux/sunrpc/sched.h | 1 - net/sunrpc/sched.c | 6 ++---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/include/linux/sunrpc/sched.h b/include/linux/sunrpc/sched.h index 0b7d333f624e..c41f5f498b3b 100644 --- a/include/linux/sunrpc/sched.h +++ b/include/linux/sunrpc/sched.h @@ -183,7 +183,6 @@ struct rpc_task_setup { struct rpc_timer { struct timer_list timer; struct list_head list; - unsigned long expires; }; /* diff --git a/net/sunrpc/sched.c b/net/sunrpc/sched.c index 40944c34a9e4..301e0f7f1dc9 100644 --- a/net/sunrpc/sched.c +++ b/net/sunrpc/sched.c @@ -92,8 +92,7 @@ __rpc_disable_timer(struct rpc_wait_queue *queue, struct rpc_task *task) static void rpc_set_queue_timer(struct rpc_wait_queue *queue, unsigned long expires) { - queue->timer_list.expires = expires; - mod_timer(&queue->timer_list.timer, expires); + timer_reduce(&queue->timer_list.timer, expires); } /* @@ -107,8 +106,7 @@ __rpc_add_timer(struct rpc_wait_queue *queue, struct rpc_task *task, task->tk_pid, jiffies_to_msecs(timeout - jiffies)); task->tk_timeout = timeout; - if (list_empty(&queue->timer_list.list) || time_before(timeout, queue->timer_list.expires)) - rpc_set_queue_timer(queue, timeout); + rpc_set_queue_timer(queue, timeout); list_add(&task->u.tk_wait.timer_list, &queue->timer_list.list); }