From patchwork Wed Sep 14 22:25:03 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rasmus Villemoes X-Patchwork-Id: 9332587 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B67836077A for ; Wed, 14 Sep 2016 22:26:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B319D27CF3 for ; Wed, 14 Sep 2016 22:26:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A753228454; Wed, 14 Sep 2016 22:26:15 +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=-6.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID 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 1FAD927CF3 for ; Wed, 14 Sep 2016 22:26:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1763787AbcINW0N (ORCPT ); Wed, 14 Sep 2016 18:26:13 -0400 Received: from mail-wm0-f51.google.com ([74.125.82.51]:36796 "EHLO mail-wm0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751168AbcINW0M (ORCPT ); Wed, 14 Sep 2016 18:26:12 -0400 Received: by mail-wm0-f51.google.com with SMTP id b187so68860472wme.1 for ; Wed, 14 Sep 2016 15:26:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rasmusvillemoes.dk; s=google; h=from:to:cc:subject:date:message-id; bh=sA9LQnyF9c6jg8MNYFYZwZ7qN6rd7eXPh6ciETvuy6U=; b=TEa7fa4gl4l7i3zHWVk2PCWLIigazSsBOQ7DHAEqMDzG0ADmToHx1BMsUFUEYNuASk g5a83ZYySpiGyik8J87Vir7zyb8hzATTPgrVhEA68t24ov5WeMnEOz2bsFvwX3dWQkkv VRuLgir5wHpJkdpoUDBbi+YxnwjoHMJc/PWnQ= 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=sA9LQnyF9c6jg8MNYFYZwZ7qN6rd7eXPh6ciETvuy6U=; b=RUtLXi3D4w0YBf1NjA9zmHmUIUBuDo1S4qMv44JQ7+96DkUx8KH3U6DtmCNUD9UHOL 6HBcXAtbr40diovbRUBEtQzNwPzyW+qcnsHQKBLIulo3RJG5o7ZDC0Iv0oCKxIqHyWZR mvdCOESob0XkHx8bhxgQm91IIgyQE7W4x/uG2jFr8h5V3XjL06PZI4rz6Qsu/xAD9bC0 Wi7PXmv5mr7IT+AywS3zQ3PYe1lbspOnzgzLLZJfz4K02Hv4iSFk5+U037sNCPvqLrp4 /cVtq/tDEjpDFxX5FcmKeLtaFd6H8d2w4R7k0z1Lheb3nLPclsypEnlkW1FIQWxsbFPr GhqQ== X-Gm-Message-State: AE9vXwMhqELFvHff2ZZ9nLA2BgIok3IxJL8o/PkGb0tzY6hL7V1hPSAAHsTM9QDHUB74pg== X-Received: by 10.194.88.137 with SMTP id bg9mr4734708wjb.155.1473891971309; Wed, 14 Sep 2016 15:26:11 -0700 (PDT) Received: from wildmoose.dk (wildmoose.dk. [87.230.87.209]) by smtp.gmail.com with ESMTPSA id w129sm955911wmd.9.2016.09.14.15.26.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 14 Sep 2016 15:26:10 -0700 (PDT) From: Rasmus Villemoes To: Benjamin LaHaise , Alexander Viro Cc: Rasmus Villemoes , linux-fsdevel@vger.kernel.org, linux-aio@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH] fs/aio.c: eliminate redundant loads in put_aio_ring_file Date: Thu, 15 Sep 2016 00:25:03 +0200 Message-Id: <1473891903-11973-1-git-send-email-linux@rasmusvillemoes.dk> X-Mailer: git-send-email 2.1.4 Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Using a local variable we can prevent gcc from reloading aio_ring_file->f_inode->i_mapping twice, eliminating 2x2 dependent loads. Signed-off-by: Rasmus Villemoes --- fs/aio.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/fs/aio.c b/fs/aio.c index fb8e45b88cd4..32ce10e55723 100644 --- a/fs/aio.c +++ b/fs/aio.c @@ -269,14 +269,17 @@ __initcall(aio_setup); static void put_aio_ring_file(struct kioctx *ctx) { struct file *aio_ring_file = ctx->aio_ring_file; + struct address_space *i_mapping; + if (aio_ring_file) { truncate_setsize(aio_ring_file->f_inode, 0); /* Prevent further access to the kioctx from migratepages */ - spin_lock(&aio_ring_file->f_inode->i_mapping->private_lock); - aio_ring_file->f_inode->i_mapping->private_data = NULL; + i_mapping = aio_ring_file->f_inode->i_mapping; + spin_lock(&i_mapping->private_lock); + i_mapping->private_data = NULL; ctx->aio_ring_file = NULL; - spin_unlock(&aio_ring_file->f_inode->i_mapping->private_lock); + spin_unlock(&i_mapping->private_lock); fput(aio_ring_file); }