Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp3525609imm; Mon, 2 Jul 2018 00:12:26 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLfqxNQN+M2opV6VA6GqWqv66fqpKv4udvApU6B1dZXFE86rM5X3m3plIYLLbL17GsVlZhP X-Received: by 2002:a17:902:b946:: with SMTP id h6-v6mr24013740pls.1.1530515546676; Mon, 02 Jul 2018 00:12:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530515546; cv=none; d=google.com; s=arc-20160816; b=VnmLp01wggalBKXQIjXbNMWvOzDybXpgUH8z0ANMrj5tUmf8eNAYRwZppbMV55GAZM yCwp+dFljW3gFKrG+O676aaqEqVBwd5zp4ByUQpRmKY/yvkzUGaoKFn3uXmcy2YAwKwF cC6a4A7qSZFeTWStaWpIZ9BuEdA0u4F5WbMeOG1vTxdfzHkCZZDHj6+Tl20CYJqYyXYN A9jg9dWBiEewqBMX/JQ/2ZUIbglwzcJnohFPC2rPC06iD6Ch4WrmQy/WIior+OzK8HUt rb7DnvVndze5BxRyA+2U4kNJgrHB5QgT9FCc1kWB8AnMK3s/puC3rGkv7kHpf6Qjfp1u 293w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=xyYvr2n2Ffxx6nNZZlg0JE2ff+od+LrjFtC9AHuR1Aw=; b=XXgVphTHCzgEOD436MMcVVKmgjDPt559y3uz1xbGAA/REV75LZgfUzJO0GVmRkAtmS 9IB6/eCghRnbxaYXkWQ+mxFFRmGXYfdisy/sx6UnePvdV7MRQTX32+AoCrH2xYjkUy6u y5z7scl1Z64+pzZ4WoG+mdAL6MW7Ihuc4+ZmmeoYrR5BE1IgYPFvUzFVDO/zbamibznS t+P9FKsrFfCnCrrjzOSV9dLKcsg57PswWL3b1jq5iejxMSSptCcVql0GcNjMgHaFcgMy bdCOw7IxUCteBp9hxBuCJwocQr7JvzG7p+bhZdJBn/1e67oWCZBvDoc1F1e4UYi16K60 9cAA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s2-v6si15540937plq.372.2018.07.02.00.12.12; Mon, 02 Jul 2018 00:12:26 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933010AbeGBHHD (ORCPT + 99 others); Mon, 2 Jul 2018 03:07:03 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:41438 "EHLO huawei.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S932864AbeGBHHB (ORCPT ); Mon, 2 Jul 2018 03:07:01 -0400 Received: from DGGEMS411-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id D12441C2E5756; Mon, 2 Jul 2018 15:06:56 +0800 (CST) Received: from [127.0.0.1] (10.63.173.108) by DGGEMS411-HUB.china.huawei.com (10.3.19.211) with Microsoft SMTP Server id 14.3.382.0; Mon, 2 Jul 2018 15:06:50 +0800 Subject: Re: [PATCH net-next 05/10] net: hns3: using modulo for cyclic counters in hclge_cmd_send To: David Miller CC: , , , , References: <1530271385-49668-1-git-send-email-lipeng321@huawei.com> <1530271385-49668-6-git-send-email-lipeng321@huawei.com> <20180630.210342.804224843120744818.davem@davemloft.net> From: "lipeng (Y)" Message-ID: <5ef0b797-67ff-e84a-367d-bd3da96a13b3@huawei.com> Date: Mon, 2 Jul 2018 15:06:46 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: <20180630.210342.804224843120744818.davem@davemloft.net> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-Originating-IP: [10.63.173.108] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2018/6/30 20:03, David Miller wrote: > From: Peng Li > Date: Fri, 29 Jun 2018 19:23:00 +0800 > >> @@ -228,8 +228,7 @@ int hclge_cmd_send(struct hclge_hw *hw, struct hclge_desc *desc, int num) >> desc_to_use = &hw->cmq.csq.desc[hw->cmq.csq.next_to_use]; >> *desc_to_use = desc[handle]; >> (hw->cmq.csq.next_to_use)++; >> - if (hw->cmq.csq.next_to_use == hw->cmq.csq.desc_num) >> - hw->cmq.csq.next_to_use = 0; >> + hw->cmq.csq.next_to_use %= hw->cmq.csq.desc_num; >> handle++; > I would advise against this. > > The "%" modulus operation takes many cpu cycles, and the current code > is thus much faster. > > . Agree with you. Thanks for your review, we  concentrate on  the code style and ignore the performance in this patch, It is not good. I will remove this patch from the patchset. >