From patchwork Mon Jul 22 15:23:12 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 2831424 Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 8BAEAC0319 for ; Mon, 22 Jul 2013 15:23:25 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8F90C201F7 for ; Mon, 22 Jul 2013 15:23:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A1CF5201F4 for ; Mon, 22 Jul 2013 15:23:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756549Ab3GVPXQ (ORCPT ); Mon, 22 Jul 2013 11:23:16 -0400 Received: from gerard.telenet-ops.be ([195.130.132.48]:48148 "EHLO gerard.telenet-ops.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756539Ab3GVPXQ (ORCPT ); Mon, 22 Jul 2013 11:23:16 -0400 Received: from [192.168.1.101] ([178.119.235.68]) by gerard.telenet-ops.be with bizsmtp id 3TPD1m00f1VD9XW0HTPDK0; Mon, 22 Jul 2013 17:23:14 +0200 Message-ID: <51ED4E60.30203@acm.org> Date: Mon, 22 Jul 2013 17:23:12 +0200 From: Bart Van Assche User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130620 Thunderbird/17.0.7 MIME-Version: 1.0 To: linux-rdma , Or Gerlitz , David Miller Subject: [PATCH, RFC] mlx4: Avoid that mlx4_cmd_wait() contributes to the system load Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-8.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Avoid that kernel threads running mlx4_cmd_wait() contribute to the system load by setting the task state to TASK_INTERRUPTIBLE instead of TASK_UNINTERRUPTIBLE while waiting. This patch reduces the load average from about 0.5 to about 0.0 on an idle system with one mlx4 HCA and no IB cables connected. Note: I'm posting this patch as an RFC since it involves a behavior change (a signal sent to a worker thread that is waiting for a command to finish causes the command to fail) and since I'm not sure this behavior change is acceptable. Signed-off-by: Bart Van Assche --- drivers/net/ethernet/mellanox/mlx4/cmd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx4/cmd.c b/drivers/net/ethernet/mellanox/mlx4/cmd.c index 299d018..fb7f7fa 100644 --- a/drivers/net/ethernet/mellanox/mlx4/cmd.c +++ b/drivers/net/ethernet/mellanox/mlx4/cmd.c @@ -559,8 +559,8 @@ static int mlx4_cmd_wait(struct mlx4_dev *dev, u64 in_param, u64 *out_param, mlx4_cmd_post(dev, in_param, out_param ? *out_param : 0, in_modifier, op_modifier, op, context->token, 1); - if (!wait_for_completion_timeout(&context->done, - msecs_to_jiffies(timeout))) { + if (wait_for_completion_interruptible_timeout(&context->done, + msecs_to_jiffies(timeout)) <= 0) { mlx4_warn(dev, "command 0x%x timed out (go bit not cleared)\n", op); err = -EBUSY;