From patchwork Thu Apr 16 13:11:03 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guy Shapiro X-Patchwork-Id: 6225751 Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id D0E559F54F for ; Thu, 16 Apr 2015 13:12:07 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 06B7A2017D for ; Thu, 16 Apr 2015 13:12:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0E14D2027D for ; Thu, 16 Apr 2015 13:12:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757427AbbDPNMC (ORCPT ); Thu, 16 Apr 2015 09:12:02 -0400 Received: from ns1327.ztomy.com ([193.47.165.129]:37073 "EHLO mellanox.co.il" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1757428AbbDPNLc (ORCPT ); Thu, 16 Apr 2015 09:11:32 -0400 Received: from Internal Mail-Server by MTLPINE1 (envelope-from guysh@mellanox.com) with ESMTPS (AES256-SHA encrypted); 16 Apr 2015 16:11:08 +0300 Received: from gen-l-vrt-034.mtl.labs.mlnx (gen-l-vrt-034.mtl.labs.mlnx [10.137.34.1]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id t3GDB8dt028654; Thu, 16 Apr 2015 16:11:08 +0300 From: Guy Shapiro To: linux-rdma@vger.kernel.org Cc: guysh@mellanox.com, raindel@mellanox.com, sagig@dev.mellanox.co.il Subject: [PATCH v1 2/2] IB/core: dma unmap optimizations Date: Thu, 16 Apr 2015 16:11:03 +0300 Message-Id: <1429189863-16460-3-git-send-email-guysh@mellanox.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1429189863-16460-1-git-send-email-guysh@mellanox.com> References: <1429189863-16460-1-git-send-email-guysh@mellanox.com> 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.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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 While unmapping an ODP writable page, the dirty bit of the page is set. In order to do so, the head of the compound page is found. Currently, the compound head is found even on non-writable pages, where it is never used, leading to unnecessary cpu barrier that impacts performance. This patch moves the search for the compound head to be done only when needed. Signed-off-by: Guy Shapiro Acked-by: Shachar Raindel Reviewed-by: Sagi Grimberg --- drivers/infiniband/core/umem_odp.c | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-) diff --git a/drivers/infiniband/core/umem_odp.c b/drivers/infiniband/core/umem_odp.c index aba4739..cc6e604 100644 --- a/drivers/infiniband/core/umem_odp.c +++ b/drivers/infiniband/core/umem_odp.c @@ -637,7 +637,6 @@ void ib_umem_odp_unmap_dma_pages(struct ib_umem *umem, u64 virt, idx = (addr - ib_umem_start(umem)) / PAGE_SIZE; if (umem->odp_data->page_list[idx]) { struct page *page = umem->odp_data->page_list[idx]; - struct page *head_page = compound_head(page); dma_addr_t dma = umem->odp_data->dma_list[idx]; dma_addr_t dma_addr = dma & ODP_DMA_ADDR_MASK; @@ -655,7 +654,7 @@ void ib_umem_odp_unmap_dma_pages(struct ib_umem *umem, u64 virt, * continuing and allowing the page mapping to * be removed. */ - set_page_dirty(head_page); + set_page_dirty(compound_head(page)); /* on demand pinning support */ if (!umem->context->invalidate_range) put_page(page);