From patchwork Fri Jan 16 14:39:55 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rasmus Villemoes X-Patchwork-Id: 5648931 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.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id DF53DC058D for ; Fri, 16 Jan 2015 14:40:18 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D4D402025B for ; Fri, 16 Jan 2015 14:40:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 04A9220259 for ; Fri, 16 Jan 2015 14:40:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751969AbbAPOkP (ORCPT ); Fri, 16 Jan 2015 09:40:15 -0500 Received: from mail-lb0-f178.google.com ([209.85.217.178]:51526 "EHLO mail-lb0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751643AbbAPOkO (ORCPT ); Fri, 16 Jan 2015 09:40:14 -0500 Received: by mail-lb0-f178.google.com with SMTP id u14so18745042lbd.9 for ; Fri, 16 Jan 2015 06:40:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rasmusvillemoes.dk; s=google; h=from:to:cc:subject:date:message-id; bh=Q9dY7h5wIj0MM7dWe866UPbpTQemMNLPzmlakEKl2eY=; b=hZ3AFOQmrEkZOdxEKxKAlDAYKlzL4Fm3KMy99OW1xxJea7aBzTaEpgV4i9ngEYx3SA ODuo7XU0+c5iIEV/WI5g2Db7s9wpbWL0jrn8ExP+w8Abm1RGxwP2rGulNfSAl4fSD7Fe MD3xb25BbFVQ2R2WRsZuvjeFcB09BGm14DdIo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=Q9dY7h5wIj0MM7dWe866UPbpTQemMNLPzmlakEKl2eY=; b=LYwWJJCuWrsLNeruKutH+KYcyVOg4A8V24DNjMNFKxe+j/pufVFEUTDWRtshtcIws+ ZPpbw04GmyJiPUDgOjcjmm3Ec9/6M1xToX8grKRVJJBe0d0MDfzko03aFnTlLiVch+c8 70nyTmEBUV6Qs7mbJADBsgVhxja1TKefFN71zk+zychfXqMNO20HR7/SX8utAA934GsS VfSjMj/jQE/QAtCTsjvlbqS3LUylKm3AY9VHR8ReLkYTiy9LiGu+ltA5YYvMuwA9oSB1 UV880urINcYrudeMOeXF/wtHagaP9kHlX0MwbconnZ1XzqpWc44w2mZL2x1CzuzDj9Yt q1iw== X-Gm-Message-State: ALoCoQnZAeHidKsfhzEff2wcTPwuP17erGrHg5jIRuZPVtZTFDJGgL0kvUPCvf3FJ/ZAvoCJrD7B X-Received: by 10.112.54.167 with SMTP id k7mr9561505lbp.72.1421419212359; Fri, 16 Jan 2015 06:40:12 -0800 (PST) Received: from spencer.imf.au.dk ([130.225.20.51]) by mx.google.com with ESMTPSA id d8sm88573lbk.25.2015.01.16.06.40.11 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 16 Jan 2015 06:40:11 -0800 (PST) From: Rasmus Villemoes To: Roland Dreier , Sean Hefty , Hal Rosenstock Cc: Rasmus Villemoes , linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/2] infiniband: Help gcc generate better code for ocrdma_srq_toggle_bit Date: Fri, 16 Jan 2015 15:39:55 +0100 Message-Id: <1421419196-4659-1-git-send-email-linux@rasmusvillemoes.dk> X-Mailer: git-send-email 2.1.3 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID,T_RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=ham 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 gcc emits a surprising amount of code in order to flip a bit. One would think that a single instruction is enough. $ scripts/bloat-o-meter /tmp/ocrdma_verbs.o drivers/infiniband/hw/ocrdma/ocrdma_verbs.o add/remove: 0/0 grow/shrink: 0/3 up/down: 0/-142 (-142) function old new delta ocrdma_post_srq_recv 498 460 -38 ocrdma_poll_cq 2010 1962 -48 ocrdma_discard_cqes 495 439 -56 All three calls of ocrdma_srq_toggle_bit happen within spinlocks, so saving a few useless instructions might be worthwhile. Signed-off-by: Rasmus Villemoes Acked-by: Selvin Xavier --- drivers/infiniband/hw/ocrdma/ocrdma_verbs.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c index fb8d8c4dfbb9..eff11e6c6183 100644 --- a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c +++ b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c @@ -1484,10 +1484,7 @@ static void ocrdma_srq_toggle_bit(struct ocrdma_srq *srq, int idx) int i = idx / 32; unsigned int mask = (1 << (idx % 32)); - if (srq->idx_bit_fields[i] & mask) - srq->idx_bit_fields[i] &= ~mask; - else - srq->idx_bit_fields[i] |= mask; + srq->idx_bit_fields[i] ^= mask; } static int ocrdma_hwq_free_cnt(struct ocrdma_qp_hwq_info *q)